home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / program / ny_src.zip / NY2008.CPP < prev    next >
C/C++ Source or Header  |  1997-04-22  |  166KB  |  6,150 lines

  1. //                        0 - Critical Door error (no fossil, etc.)
  2. //                        1 - Carrier lost, user off-line
  3. //                        2 - Sysop terminated call, user off-line
  4. //                        3 - User time used up, user STILL ON-LINE
  5. //                        4 - Keyboard inactivity timeout, user off-line
  6. //                       10 - User chose to return to BBS
  7. //                       11 - User chose to logoff, user off-line
  8. //                       12 - Critical NY2008 error
  9.  
  10.  
  11. // include the header
  12. #include "NY2008.h"
  13.  
  14. // include prototypes for fights
  15. #include "fights.h"
  16.  
  17. extern unsigned _stklen=20000U;
  18.  
  19. // declare indexes
  20. struct {
  21.     int             first_enemy[LEVELS],
  22.             last_enemy[LEVELS];
  23.     } enemy_idx;
  24.  
  25.  
  26. // price arrays
  27. long    gun_price[ULTRASOUND_GUN+1] =  {
  28.                 0,
  29.                    70,
  30.                  1500,
  31.                  7000,
  32.                 30000,
  33.                130000,
  34.                500000,
  35.               2000000,
  36.               8000000,
  37.              30000000,
  38.             130000000,
  39.             500000000,
  40.                   300,
  41.                   600,
  42.                  3000,
  43.                 12000,
  44.                 70000,
  45.                300000,
  46.                900000,
  47.               5500000,
  48.              15000000,
  49.              80000000,
  50.             150000000};
  51. int     drug_price[HEROIN+1] = {10, 25,  50, 100, 150, 150};
  52.  
  53.  
  54.  
  55. // Declare global variables
  56. int nCurrentUserNumber;
  57. int forced_maint=FALSE;
  58. int temp_len_stor;
  59. int temp_rip_stor;
  60. int temp_ans_stor;
  61. int temp_avt_stor;
  62. user_rec cur_user;
  63. enemy enemy_rec;
  64. char uname[36];
  65. int do_maint=TRUE;
  66. char str[15];
  67. int reg_check=345;
  68. int expert=1;
  69. int no_rip_m=0;
  70. int rip=FALSE;
  71. char *t_buffer=NULL;
  72. int registered=786;
  73. char *ver="1.00";
  74. char *verinfo="";
  75. int gamedisk,flagdisk=-1;
  76. int *regptr;
  77. char gamedir[MAXDIR],flagdir[MAXDIR];
  78. char c_dir_g=0;
  79. int no_wrt_sts=FALSE;
  80. int no_kernel=TRUE;
  81. int no_slices=FALSE;
  82. int autodetect=TRUE;
  83. int max_fights=20;
  84. int max_drug_hits=32767;
  85. int condom_price=5;
  86. int delete_after=15;
  87. int bank_interest=5;
  88. char ansi_name[MAXPATH]="NYSCORES.ANS";
  89. char ascii_name[MAXPATH]="NYSCORES.ASC";
  90. int do_scr_files=TRUE;
  91. char rec_credit[36];
  92. char maint_exec[MAXPATH]="";
  93. int single_node=FALSE;
  94. int clean_mode=FALSE;
  95.  
  96. char *badwords[50];
  97. int badwordscnt=0;
  98. int dobad=FALSE;
  99.  
  100. int check_o_nodes=2;
  101.  
  102.     int busted_ch_bank   =33;
  103.     int busted_ch_food   =33;
  104.     int busted_ch_rape   =33;
  105.     int busted_ch_beggar =20;
  106.     int busted_ch_car    =33;
  107.     int busted_ch_school =33;
  108.     int busted_ch_window =20;
  109.     int busted_ch_poison =25;
  110.     int busted_ch_bomb   =25;
  111.     int success_ch_bank  =50;
  112.     int success_ch_food  =50;
  113.     int success_ch_rape  =50;
  114.     int success_ch_beggar=50;
  115.     int success_ch_car   =65;
  116.     int success_ch_school=50;
  117.     int success_ch_window=95;
  118.     int success_ch_poison=33;
  119.     int success_ch_bomb  =33;
  120.  
  121. char oneframe=FALSE;
  122. int reset=FALSE;
  123. int noevents=TRUE;
  124. int time_slice_value=1500;
  125.  
  126. tIBInfo IBBSInfo;
  127. int ibbs=FALSE;
  128. int ibbs_send_nodelist=FALSE;
  129. int ibbs_maint_i=FALSE;
  130. int ibbs_maint_o=FALSE;
  131. int ibbs_i_mail=FALSE;
  132. int ibbs_operator=FALSE;
  133. int ibbs_game_num=0;
  134.  
  135. struct ffblk fff;
  136. struct ffblk ff;
  137.  
  138. void
  139. time_slice(void)
  140. {
  141.   asm {
  142.     mov ax,time_slice_value
  143.     int 15
  144.   }
  145. }
  146.  
  147. int
  148. copyfile(char *file1,char *file2)
  149. {
  150.   FILE *f1,*f2;
  151.   char *buffer;
  152.   long len1,where,x,y;
  153.  
  154.  
  155.   f1=ShareFileOpen(file1,"rb");
  156.   if(f1==NULL) return 0;
  157.   f2=ShareFileOpenAR(file2,"wb");
  158.   if(f2==NULL) {
  159.     fclose(f1);
  160.     return 0;
  161.   }
  162.  
  163.   buffer=(char *)malloc(10000);
  164.  
  165.   len1=filelength(fileno(f1));
  166.   x=len1/10000;
  167.  
  168.   for(y=0;y<x;y++) {
  169.     ny_fread(buffer,10000,1,f1);
  170.     ny_fwrite(buffer,10000,1,f2);
  171.   }
  172.  
  173.   y=len1-(x*10000);
  174.  
  175.   if(y>0) {
  176.     ny_fread(buffer,y,1,f1);
  177.     ny_fwrite(buffer,y,1,f2);
  178.   }
  179.  
  180.   fclose(f1);
  181.   fclose(f2);
  182.   free(buffer);
  183.  
  184.   return 1;
  185. }
  186.  
  187. void fullscreen_chat(void);
  188.  
  189. void
  190. ny_chat(void)
  191. {
  192.   scr_save();
  193.   od_control.od_chat_active=FALSE;
  194.   fullscreen_chat();
  195.   scr_res();
  196. }
  197.  
  198. void
  199. NoDropFile(void)
  200. {
  201.   printf("\nNew York 2008 %s %s - No dropfile found!\n",ver,verinfo);
  202.   printf("To start in Local mode type:\nNY2008 -L\n");
  203.   exit(10);
  204. }
  205.  
  206. void
  207. trim(char *numstr)
  208. {
  209.   int x;
  210.   for(x=strlen(numstr)-1;numstr[x]==' ' && x>=0;x--) od_kernal;
  211.   numstr[x+1]=0;
  212.   strrev(numstr);
  213.   for(x=strlen(numstr)-1;numstr[x]==' ' && x>=0;x--) od_kernal;
  214.   numstr[x+1]=0;
  215.   strrev(numstr);
  216. }
  217.  
  218. void
  219. loadbadwords(void)
  220. {
  221.   FILE *fp;
  222.  
  223.   char *temp;
  224.  
  225.   badwordscnt=0;
  226.  
  227.   fp=ShareFileOpenAR("BADWORDS.TXT","rt");
  228.  
  229.   long len=filelength(fileno(fp));
  230.  
  231.   if(len>4000) {
  232.     ny_disp_emu("\n\r\n`%BADWORDS FILE TOO BIG!\n\r\n");
  233.     fclose(fp);
  234.     return;
  235.   }
  236.  
  237.   temp=(char *)malloc(len+1);
  238.   if(temp==0) {
  239.     ny_disp_emu("\n\r\n`%Not Enough memory for BADWORDS.TXT\n\r\n");
  240.     fclose(fp);
  241.     return;
  242.   }
  243.  
  244.   for(int x=0;fscanf(fp,"%s",temp)!=EOF;x++) {
  245.  
  246.     badwords[x]=(char *)malloc(strlen(temp)+1);
  247.     if(badwords[x]==0) {
  248.       ny_disp_emu("\n\r\n`%Not Enough memory for BADWORDS.TXT\n\r\n");
  249.       fclose(fp);
  250.       free(temp);
  251.       return;
  252.     }
  253.     strupr(temp);
  254.     strcpy(badwords[x],temp);
  255.     badwordscnt=x+1;
  256.   }
  257.  
  258.   free(temp);
  259.   fclose(fp);
  260. }
  261.  
  262. int
  263. main(int argc,char *argv[])
  264. {
  265.   FILE *justfile,*njustfile;
  266.   char key;
  267.   unsigned int uintval;
  268.   char numstr[26];
  269.   scr_rec srec;
  270.   int cnt,intval,x;
  271.   scr_rec rec;
  272.   date today;
  273.   date lastday;
  274.  
  275.     //put your opendoors reg here
  276.     strcpy(od_registered_to,"Your Name");
  277.     od_registration_key=00000000;
  278.  
  279.   randomize();
  280.  
  281.   od_control.od_no_file_func=NoDropFile;
  282.   od_control.od_disable = DIS_BPS_SETTING | DIS_NAME_PROMPT;
  283.  
  284.   od_control.od_num_keys=1;
  285.   od_control.od_hot_key[0]=26624;
  286.   od_control.od_hot_function[0]=UserStatus;
  287.  
  288.   od_control.od_default_rip_win=TRUE;
  289.  
  290.   od_add_personality("NY2008",1,23,ny_pers);
  291.  
  292.   od_control.od_default_personality=ny_pers;
  293.  
  294.   regptr=®istered;
  295.  
  296.   directvideo=0;
  297.  
  298.   strcpy(od_control.od_prog_name,"New York 2008");
  299.  
  300.   rec_credit[0]=0;
  301.  
  302.   od_control.od_config_function = CustomConfigFunction;
  303.   if(findfirst(CFG_FILENAME,&fff,0)==0)
  304.     od_control.od_config_file = INCLUDE_CONFIG_FILE;
  305.   else
  306.     od_control.od_config_file = NO_CONFIG_FILE;
  307.   od_control.od_config_filename = CFG_FILENAME;
  308.  
  309.   od_control.od_mps=INCLUDE_MPS;
  310.   od_control.od_nocopyright=TRUE;
  311.   od_control.od_cbefore_chat=ny_chat;
  312.   od_control.od_cbefore_shell=scr_save;
  313.   od_control.od_cafter_shell=scr_res;
  314.  
  315.  
  316.   cnt=1;
  317.   if(argc>1) {
  318.     do {
  319.       if (strnicmp(argv[cnt],"RESET",5)==0) {
  320.     od_control.od_force_local=TRUE;
  321.     reset=TRUE;
  322.       } else if (strnicmp(argv[cnt],"-IBBSM",6)==0) {
  323.     ibbs_i_mail=TRUE;
  324.     od_control.od_force_local=TRUE;
  325.       } else if (strnicmp(argv[cnt],"-RIP",4)==0) {
  326.     rip=166;
  327.       } else if (strnicmp(argv[cnt],"-L",2)==0) {
  328.     od_control.od_force_local=TRUE;
  329.     clrscr();
  330.     textbackground(LIGHTCYAN);
  331.     textcolor(BLUE);
  332.     gotoxy(1,7);
  333.     cprintf("╔═════════════════════════════════════════════════════════════════════════════╗");
  334.     gotoxy(1,8);
  335.     cprintf("║ New York 2008 v%-5s %-20s                                   ║",ver,verinfo);
  336.     gotoxy(1,9);
  337.     cprintf("║ Starting in local mode input your name: ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ║");
  338.     gotoxy(1,10);
  339.     cprintf("╚═════════════════════════════════════════════════════════════════════════════╝");
  340.     gotoxy(43,9);
  341.  
  342.     int cntv=0;
  343.     intval=TRUE;
  344.     do {
  345.       if(cntv>=35) {
  346.         cntv=34;
  347.         putch('\b');
  348.         key=getch();
  349.         if(key=='\n' || key=='\r')
  350.           cntv=35;
  351.       } else {
  352.         key=getch();
  353.       }
  354.  
  355.       if(key==27) {
  356.         gotoxy(1,9);
  357.         cprintf("║ Starting in local mode input your name: ░ Canceled ... ░░░░░░░░░░░░░░░░░░░░ ║");
  358.         gotoxy(1,12);
  359.         exit(10);
  360.       }
  361.  
  362.       if(intval==TRUE) {
  363.         if (key>='a' && key<='z')
  364.           key-=32;
  365.         intval=FALSE;
  366.       } else if(intval==FALSE) {
  367.         if (key>='A' && key<='Z')
  368.           key+=32;
  369.       }
  370.       if(key==' ') {
  371.         putch('░');
  372.         key=0;
  373.         intval=TRUE;
  374.       } else if(key=='\b') {
  375.         if(cntv==0) {
  376.           intval=TRUE;
  377.           key=0;
  378.           cntv--;
  379.         } else {
  380.           cntv-=2;
  381.           if(cntv>=0 && od_control.user_name[cntv]==' ')
  382.         intval=TRUE;
  383.           if(cntv==32)
  384.         cprintf("\b░░\b\b");
  385.           else
  386.         cprintf("\b░\b");
  387.           key=0;
  388.         }
  389.       }
  390.  
  391.       if(key!=0) {
  392.         od_control.user_name[cntv]=key;
  393.         putch(key);
  394.       }
  395.       cntv++;
  396.     } while (key!='\n' && key!='\r');
  397.     od_control.user_name[cntv-1]=0;
  398.  
  399.     trim(od_control.user_name);
  400.  
  401.       } else if (strnicmp(argv[cnt],"-NAD",4)==0) {
  402.     autodetect=FALSE;
  403.       } else if (strnicmp(argv[cnt],"-P",2)==0) {
  404.     strzcpy(od_control.info_path,argv[cnt],2,61);
  405.       } else if (strnicmp(argv[cnt],"-RDBPS",6)==0) {
  406.     od_control.od_disable &=~ DIS_BPS_SETTING;
  407.       } else if (strnicmp(argv[cnt],"-CL",3)==0) {
  408.     clean_mode=TRUE;
  409.       } else if (strnicmp(argv[cnt],"-DV",3)==0) {
  410.     directvideo=1;
  411.       } else if (strnicmp(argv[cnt],"-NM",3)==0) {
  412.     do_maint=FALSE;
  413.       } else if (strnicmp(argv[cnt],"-CR",3)==0) {
  414.     od_control.od_force_local=TRUE;
  415.     od_init();
  416.     od_control.od_status_on=FALSE;
  417.     od_set_statusline(STATUS_NONE);
  418.     getcwd(gamedir,MAXDIR);
  419.     gamedisk=gamedir[0] - 'A';
  420.     strzcpy(gamedir,gamedir,2,MAXDIR);
  421.     if(flagdisk==-1) {
  422.       flagdisk=gamedisk;
  423.       strcpy(flagdir,gamedir);
  424.     }
  425.     ch_game_d();
  426.     registered=TRUE;
  427.       /*        if (findfirst(KEY_FILENAME,&fff,0)==0) {
  428.       strcpy(numstr,od_control.system_name);
  429.       get_bbsname(numstr);
  430.       registered=seereg(numstr);
  431.     }*/
  432.     ny_line(-1,0,0);
  433.     CrashRecovery();
  434.     od_exit(10,FALSE);
  435.       } else if (strnicmp(argv[cnt],"-MM",3)==0) {
  436.     od_control.od_force_local=TRUE;
  437.     od_init();
  438.     od_control.od_status_on=FALSE;
  439.     od_set_statusline(STATUS_NONE);
  440.     getcwd(gamedir,MAXDIR);
  441.     gamedisk=gamedir[0] - 'A';
  442.     strzcpy(gamedir,gamedir,2,MAXDIR);
  443.     if(flagdisk==-1) {
  444.       flagdisk=gamedisk;
  445.       strcpy(flagdir,gamedir);
  446.     }
  447.     ch_game_d();
  448.     registered=TRUE;
  449. /*      if (findfirst(KEY_FILENAME,&fff,0)==0) {
  450.       strcpy(numstr,od_control.system_name);
  451.       get_bbsname(numstr);
  452.       registered=seereg(numstr);
  453.     }*/
  454.     ny_line(-1,0,0);
  455.     forced_maint=TRUE;
  456.     Maintanance();
  457.     od_exit(10,FALSE);
  458.  
  459.       } else if (strnicmp(argv[cnt],"-M",2)==0) {
  460.     od_control.od_force_local=TRUE;
  461.     od_init();
  462.     od_control.od_status_on=FALSE;
  463.     od_set_statusline(STATUS_NONE);
  464.     getcwd(gamedir,MAXDIR);
  465.     gamedisk=gamedir[0] - 'A';
  466.     strzcpy(gamedir,gamedir,2,MAXDIR);
  467.     if(flagdisk==-1) {
  468.       flagdisk=gamedisk;
  469.       strcpy(flagdir,gamedir);
  470.     }
  471.     ch_game_d();
  472.     registered=TRUE;
  473. /*      if (findfirst(KEY_FILENAME,&fff,0)==0) {
  474.       strcpy(numstr,od_control.system_name);
  475.       get_bbsname(numstr);
  476.       registered=seereg(numstr);
  477.     }*/
  478.     ny_line(-1,0,0);
  479.     Maintanance();
  480.     od_exit(10,FALSE);
  481.       } else if (strnicmp(argv[cnt],"-N",2)==0) {
  482.     strzcpy(numstr,argv[cnt],2,59);
  483.     sscanf(numstr,"%d",&intval);
  484.     od_control.od_node=intval;
  485.       } else if (strnicmp(argv[cnt],"-C",2)==0) {
  486.     strzcpy(od_control.od_config_filename,argv[cnt],2,59);
  487.     od_control.od_config_file = INCLUDE_CONFIG_FILE;
  488.       }
  489.     } while ((++cnt)<argc);
  490.   }
  491.  
  492.   nCurrentUserNumber=MAX_USERS+1;
  493.  
  494.   od_init();
  495.   if(!od_control.od_force_local)
  496.     od_control.od_clear_on_exit=FALSE;
  497.  
  498.   getcwd(gamedir,MAXDIR);
  499.   gamedisk=gamedir[0] - 'A';
  500.   strzcpy(gamedir,gamedir,2,MAXDIR);
  501.   if(flagdisk==-1) {
  502.     flagdisk=gamedisk;
  503.     strcpy(flagdir,gamedir);
  504.   }
  505.  
  506.  
  507.   od_control.od_disable |= DIS_INFOFILE;
  508.  
  509.   if(no_slices==FALSE)
  510.     od_control.od_ker_exec=time_slice;
  511.   else
  512.     od_control.od_ker_exec=NULL;
  513.  
  514.   if(od_control.user_screen_length<2)
  515.     od_control.user_screen_length=24;
  516.  
  517.   od_control.od_help_text2=(char *)"  New York 2008 v1.00 (c) 1995-97 George Lebl   Alt-[F1]=NY2008 Status Bar    ";
  518.  
  519.   temp_rip_stor=od_control.user_rip;
  520.   temp_ans_stor=od_control.user_ansi;
  521.   temp_avt_stor=od_control.user_avatar;
  522.  
  523.   if(rip!=166) {
  524.     if(autodetect==TRUE)
  525.     od_autodetect(DETECT_NORMAL);
  526.  
  527.     rip=od_control.user_rip;
  528.     if(rip) {
  529.       temp_len_stor=od_control.user_screen_length;
  530.       od_control.user_screen_length=35;
  531.     }
  532.   } else {
  533.     rip=TRUE;
  534.     od_control.user_rip=TRUE;
  535.     temp_len_stor=od_control.user_screen_length;
  536.     od_control.user_screen_length=35;
  537.   }
  538.  
  539.   char *InComing;
  540.   char *OutGoing;
  541.   ibbs_mail_type ibmail;
  542.  
  543.   registered=TRUE;
  544. /*  if (findfirst(KEY_FILENAME,&fff,0)==0) {
  545.     strcpy(numstr,od_control.system_name);
  546.     get_bbsname(numstr);
  547.     registered=seereg(numstr);
  548.   }*/
  549.  
  550.   if(!registered)
  551.     ibbs=FALSE;
  552.  
  553.   if(ibbs==TRUE) {
  554.     ch_game_d();
  555.     int xx;
  556.     strcpy(IBBSInfo.szThisNodeAddress, "0:000/000");
  557.     sprintf(IBBSInfo.szProgName, "#@NYG#%05d IBBS",ibbs_game_num);
  558.     strcpy(IBBSInfo.szNetmailDir, "C:\FD\NETMAIL");
  559.     IBBSInfo.bCrash = FALSE;
  560.     IBBSInfo.bHold = FALSE;
  561.     IBBSInfo.bEraseOnSend = TRUE;
  562.     IBBSInfo.bEraseOnReceive = TRUE;
  563.     IBBSInfo.nTotalSystems = 0;
  564.     IBBSInfo.paOtherSystem = NULL;
  565.     IBReadConfig(&IBBSInfo, "INTERBBS.CFG");
  566.     IBReadConfig(&IBBSInfo, "NYNODE.LST");
  567.  
  568.     char szDirFileName[PATH_CHARS + 1];
  569.  
  570.    if(IBBSInfo.szNetmailDir==NULL || strlen(IBBSInfo.szNetmailDir)>PATH_CHARS) {
  571.      od_printf("\n\r\nNETMAIL DIR NOT FOUND\n\r\n");
  572.      od_exit(10,FALSE);
  573.    }
  574.  
  575.    strcpy(szDirFileName, IBBSInfo.szNetmailDir);
  576.  
  577.    /* Remove any trailing backslash from directory name */
  578.    if(szDirFileName[strlen(szDirFileName) - 1] == '\\')
  579.      szDirFileName[strlen(szDirFileName) - 1] = '\0';
  580.  
  581.  
  582.    /* Return true iff file exists and it is a directory */
  583.    if(!(findfirst(szDirFileName, &fff, FA_ARCH|FA_DIREC) == 0 && (fff.ff_attrib & FA_DIREC))) {
  584.      od_printf("\n\r\nNETMAIL DIR NOT FOUND\n\r\n");
  585.      od_exit(10,FALSE);
  586.    }
  587.  
  588.     if(IBBSInfo.nTotalSystems>255)
  589.       IBBSInfo.nTotalSystems=255;
  590.  
  591.     if(ibbs_i_mail) {
  592.       ny_disp_emu("\n\r`0##> Getting InterBBS Mail\n\r");
  593.       sprintf(IBBSInfo.szProgName, "#@NYG#%05d MAIL",ibbs_game_num);
  594.  
  595.       justfile=ShareFileOpen("NYIBBS.MIN","a+b");
  596.       while(IBGetMail(&IBBSInfo,&ibmail) == eSuccess) {
  597.  
  598.     if(strcmp(ibmail.node_r,IBBSInfo.szThisNodeAddress)==0)
  599.       ny_fwrite(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  600.       }
  601.       fclose(justfile);
  602.     }
  603.   }
  604.  
  605.   if(rip) {
  606.     od_control.user_ansi=TRUE;
  607.     od_disp_str("\n\r!|*|10$SBAROFF$$HKEYOFF$|#|#|#\n\r");
  608.     od_control.od_no_time=(char *)"\n\r!|10((Sorry, you have used up all your time for today::@OK))|#|#|#\n\r";
  609.     od_control.od_time_warning=(char *)"\n\r!|10((Warning, only %d minute(s) remaining today!::@OK))|#|#|#\n\r";
  610.     od_control.od_inactivity_warning=(char *)"\n\r!|10((Warning, inactivity timeout in %d minute(s)!::@OK))|#|#|#\n\r";
  611.     od_control.od_inactivity_timeout=(char *)"\n\r!|10((Inactivity Timeout!::@OK))|#|#|#\n\r";
  612.   }
  613.  
  614.  
  615.   if(reset==TRUE) {
  616.     od_control.od_status_on=FALSE;
  617.     od_set_statusline(STATUS_NONE);
  618.     od_clr_scr();
  619.     ny_disp_emu("`@N`4ew `@Y`4ork `@2008 `%RESET `@U`4tility");
  620.     ny_disp_emu("\n\n\r`2Not all options may aply to you. If you are not in an `0InterBBS`2 game");
  621.     ny_disp_emu("\n\rand just wish to `0RESET`2 your game choose 1.");
  622.  
  623.     ny_disp_emu("\n\n\r`%1 `4- `@R`4eset `@T`4he `@G`4ame `@O`4nly `2(You will stay in an InterBBS game)");
  624.     ny_disp_emu("\n\r`%2 `4- `@G`4et `@O`4ut `@O`4f `@InterBBS `2(The game will `0NOT `2be RESET)");
  625.     ny_disp_emu("\n\r`%Q `4- `@Q`4uit `@T`4his `2(No RESETs)");
  626.  
  627.     ny_disp_emu("\n\n\r`@Y`4our `@C`4hoice: `0");
  628.     key=od_get_answer("12Q");
  629.     od_printf("%c",(char)key);
  630.     if(key=='1') {
  631.       ny_disp_emu("\n\n\r`@T`4he current game `%WILL `4be lost`%!");
  632.       ny_disp_emu("\n\n\r`@A`4re you sure you want to `%RESET `4(`@Y`4/`@N`4):");
  633.       key=od_get_answer("YN");
  634.  
  635.       od_printf("%c\n\n\r",(char)key);
  636.  
  637.       if(key=='Y') {
  638.     ny_disp_emu("`%Ignore any error messages following this\n\n\r");
  639.     ch_flag_d();
  640.  
  641.     ny_remove("U00?????.*");
  642.     ny_remove("MNU*.DAT");
  643.     ny_remove("EVT*.DAT");
  644.     ny_remove("N00?????.*");
  645.     ny_remove("maint.run");
  646.  
  647.     ch_game_d();
  648.  
  649.     ny_remove("ny2008.usr");
  650.     ny_remove("ny2008.scr");
  651.     ny_remove("nylast.mnt");
  652.     ny_remove("nygame.day");
  653.     ny_remove("ny2008.msg");
  654.     ny_remove("ny2008.msx");
  655.     ny_remove("SENTBEST.TEN");
  656.     ny_remove("SENTLIST.PL");
  657.       }
  658.     } else if(key=='2') {
  659.       ny_disp_emu("\n\n\r`@Y`4ou will be taken out of this InterBBS game!");
  660.       ny_disp_emu("\n\r`@M`4ake sure the operator bbs of this game has taken you out of the nodelist!");
  661.       ny_disp_emu("\n\r`@A`4nd turn the InterBBS keyword off in your .cfg file!");
  662.       ny_disp_emu("\n\n\r`@A`4re you sure you want to `%Get Local Only? `4(`@Y`4/`@N`4):");
  663.       key=od_get_answer("YN");
  664.  
  665.       od_printf("%c\n\n\r",(char)key);
  666.  
  667.       if(key=='Y') {
  668.     ny_disp_emu("`%Ignore any error messages following this\n\n\r");
  669.     ch_game_d();
  670.  
  671.     ny_remove("nynode.lst");
  672.     ny_remove("nyspydb.*");
  673.     ny_remove("nyibbs.spy");
  674.     ny_remove("nyibbs.tmp");
  675.     ny_remove("nyibbs.min");
  676.     ny_remove("nyibbest.ten");
  677.     ny_remove("nyspydbt.*");
  678.     ny_remove("SENTBEST.TEN");
  679.     ny_remove("SENTLIST.PL");
  680.       }
  681.     }
  682.     od_exit(10,FALSE);
  683.   }
  684.  
  685.   registered=TRUE;
  686. /*  if (findfirst(KEY_FILENAME,&fff,0)==0) {
  687.     strcpy(numstr,od_control.system_name);
  688.     get_bbsname(numstr);
  689.     registered=seereg(numstr);
  690.   }*/
  691.  
  692.   ny_line(-1,0,0);
  693.   ny_stat_line(-1,0,0);
  694.  
  695.   //load bad wordlist
  696.   if(findfirst("BADWORDS.TXT",&fff,0)==0) {
  697.     loadbadwords();
  698.     dobad=TRUE;
  699.   }
  700.  
  701. //  char test1[]="shit man this fucking thing is fucking done !assfucked";
  702. //  dobadwords(test1);
  703. //  od_printf("\n\r\n%s\n\r\n",test1);
  704. //  WaitForEnter();
  705.  
  706.   ny_line(267,1,0);
  707.  
  708.   if (rip==FALSE) {
  709.     ny_line(268,1,0);
  710.     //(Xpert mode recomended for slow modems)
  711.     ny_line(269,1,0);
  712.     //Wanna start in Xpert, Regular or Novice mode (X/[R]/N)
  713.     key=od_get_answer("XRN\n\r");
  714.     if (key=='\n' || key=='\r') key='R';
  715.     if (key=='N') expert=0;
  716.     if (key=='R') expert=1;
  717.     if (key=='X') expert=2;
  718.     od_printf("%c\n\r\n\r",key);
  719.  
  720.     if(*regptr==TRUE && reg_check==784)
  721.       od_exit(10,TRUE);
  722.  
  723.  
  724.     if (expert<2) {
  725.       ny_clr_scr();
  726.       od_send_file("INTRO");
  727.       ny_line(1,1,0);
  728.       //Smack [ENTER] to go on.
  729.       od_get_answer("\n\r");
  730.     }
  731.   } else {
  732.     expert=0;
  733.     od_printf("\n\r\n\r");
  734.     ny_clr_scr();
  735.     od_send_file("INTRO");
  736.     ny_line(1,1,0);
  737.     od_get_answer("\n\r");
  738.   }
  739.   if(rip) ny_clr_scr();
  740.   ny_line(2,2,1);
  741.   //Getting the menu text file pointers...
  742.   ny_get_index();
  743.  
  744.   if(*regptr==TRUE && reg_check==784)
  745.     od_exit(10,TRUE);
  746.  
  747.  
  748.   if(ibbs)
  749.     DisplayBestIB();
  750.   else
  751.     DisplayBest();
  752.  
  753.   if (registered==FALSE) {
  754.     max_fights       =20;
  755.     delete_after     =15;
  756.     busted_ch_bank   =33;
  757.     busted_ch_food   =33;
  758.     busted_ch_rape   =33;
  759.     busted_ch_beggar =20;
  760.     busted_ch_car    =33;
  761.     busted_ch_school =33;
  762.     busted_ch_window =20;
  763.     busted_ch_poison =25;
  764.     busted_ch_bomb   =25;
  765.     success_ch_bank  =50;
  766.     success_ch_food  =50;
  767.     success_ch_rape  =50;
  768.     success_ch_beggar=50;
  769.     success_ch_car   =65;
  770.     success_ch_school=50;
  771.     success_ch_window=95;
  772.     success_ch_poison=33;
  773.     success_ch_bomb  =33;
  774.   }
  775.  
  776.  
  777.   ch_flag_d();
  778.   if (single_node==FALSE && findfirst("MAINT.RUN",&fff,0)==0) {
  779.     od_printf("\n\r\n\r");
  780.     if(rip) ny_clr_scr();
  781.     ny_send_menu(MAINT_RUN,"");
  782. /*    od_printf("\n\r\n\r`bright red`W`red`ell the mantanace is running on some other node so please come");
  783.     od_printf("back later, or\n\rif it is a one node bbs or the sysop's running the maintanance in the nightly\n\rbatch file ");
  784.     od_printf("then he should delete the MAINT.RUN flag file....");*/
  785.     WaitForEnter();
  786.     od_exit(10,FALSE);
  787.   }
  788. //  if (single_node==TRUE && findfirst(".RUN",&fff,0)==0) {
  789.  
  790.  
  791.   ch_game_d();
  792.   if (findfirst(USER_FILENAME,&fff,0)!=0) { // player first in play run maint after he logs in
  793.     if(!ReadOrAddCurrentUser())
  794.     {
  795.       /* If unable to obtain a user record for the current user, then exit */
  796.       /* the door after displaying an error message.                       */
  797.       if(rip) ny_clr_scr();
  798.       od_printf("Unable to access user file. File may be locked or full.\n\r");
  799.       WaitForEnter();
  800.       od_exit(1, FALSE);
  801.     }
  802.  
  803.   //  strcpy(uname,od_control.user_name);
  804.   //  sprintf(od_control.user_name,"%s (%s)",cur_user.name,uname);
  805.   strcpy(rec.name,cur_user.name);
  806.   rec.nation=cur_user.nation;
  807.   rec.level=cur_user.level;
  808.   rec.points=cur_user.points;
  809.   rec.alive=cur_user.alive;
  810.   rec.sex=cur_user.sex;
  811.   rec.user_num=nCurrentUserNumber;
  812.   rec.online=FALSE;
  813.  
  814.   ch_game_d();
  815.   justfile=ShareFileOpen(SCR_FILENAME,"wb");
  816.   ny_fwrite(&rec, sizeof(scr_rec), 1, justfile);
  817.   fclose(justfile);
  818.  
  819.   date today;
  820.  
  821.     getdate(&today);
  822.  
  823.       ch_game_d();
  824.       justfile=ShareFileOpen("NYLAST.MNT","wb");
  825.       ny_fwrite(&today, sizeof(date), 1, justfile);
  826.       fclose(justfile);
  827.       justfile=ShareFileOpen("NYGAME.DAY","wb");
  828.       intval=1;
  829.       ny_fwrite(&intval,2,1,justfile);
  830.       fclose(justfile);
  831.  
  832.  
  833.   } else {
  834.     /*Run Maintanance if it hasn't been run yet...*/
  835.     if (do_maint==TRUE) {
  836.       od_control.od_disable |= DIS_CARRIERDETECT;
  837. //      od_set_statusline(STATUS_NONE);
  838.       Maintanance();
  839. //      od_set_statusline(STATUS_NORMAL);
  840.       od_control.od_disable &=~ DIS_CARRIERDETECT;
  841.       if(!ReadOrAddCurrentUser())
  842.       {
  843.     /* If unable to obtain a user record for the current user, then exit */
  844.     /* the door after displaying an error message.                       */
  845.     if(rip) ny_clr_scr();
  846.     od_printf("Unable to access user file. File may be locked or full.\n\r");
  847.     WaitForEnter();
  848.     od_exit(1, FALSE);
  849.       }
  850.     } else {
  851.       if(!ReadOrAddCurrentUser())
  852.       {
  853.     /* If unable to obtain a user record for the current user, then exit */
  854.     /* the door after displaying an error message.                       */
  855.     if(rip) ny_clr_scr();
  856.     od_printf("Unable to access user file. File may be locked or full.\n\r");
  857.     WaitForEnter();
  858.     od_exit(1, FALSE);
  859.       }
  860.       ch_game_d();
  861.       if (findfirst("NYLAST.MNT",&fff,0)==0) {
  862.     justfile = ShareFileOpen("NYLAST.MNT", "rb");
  863.     ny_fread(&lastday, sizeof(date), 1, justfile);
  864.     fclose(justfile);
  865.     if (lastday.da_year!=today.da_year || lastday.da_mon!=today.da_mon || lastday.da_day!=today.da_day) {
  866.       ch_flag_d();
  867.       sprintf(numstr,"u%07d.tdp",nCurrentUserNumber);
  868.       if(findfirst(numstr,&fff,0)!=0) {
  869.         cur_user.days_not_on++;
  870.  
  871.         getdate(&today);
  872.  
  873.         justfile=ShareFileOpen(numstr,"wb");
  874.         ny_fwrite(&today,sizeof(date),1,justfile);
  875.         fclose(justfile);
  876.       } else {
  877.         justfile=ShareFileOpen(numstr,"rb");
  878.         ny_fread(&lastday,sizeof(date),1,justfile);
  879.         fclose(justfile);
  880.  
  881.         getdate(&today);
  882.  
  883.         if (lastday.da_year!=today.da_year || lastday.da_mon!=today.da_mon || lastday.da_day!=today.da_day) {
  884.           cur_user.days_not_on++;
  885.           justfile=ShareFileOpen(numstr,"wb");
  886.           ny_fwrite(&today,sizeof(date),1,justfile);
  887.           fclose(justfile);
  888.         }
  889.       }
  890.     }
  891.       } else {
  892.     ch_flag_d();
  893.     sprintf(numstr,"u%07d.tdp",nCurrentUserNumber);
  894.     if(findfirst(numstr,&fff,0)!=0) {
  895.       cur_user.days_not_on++;
  896.   /*      justfile=ShareFileOpen(numstr,"w");
  897.       fclose(justfile);*/
  898.  
  899.       getdate(&today);
  900.  
  901.       justfile=ShareFileOpen(numstr,"wb");
  902.       ny_fwrite(&today,sizeof(date),1,justfile);
  903.       fclose(justfile);
  904.     } else {
  905.       justfile=ShareFileOpen(numstr,"rb");
  906.       ny_fread(&lastday,sizeof(date),1,justfile);
  907.       fclose(justfile);
  908.  
  909.       getdate(&today);
  910.  
  911.       if (lastday.da_year!=today.da_year || lastday.da_mon!=today.da_mon || lastday.da_day!=today.da_day) {
  912.         cur_user.days_not_on++;
  913.         justfile=ShareFileOpen(numstr,"wb");
  914.         ny_fwrite(&today,sizeof(date),1,justfile);
  915.         fclose(justfile);
  916.       }
  917.     }
  918.       }
  919.     }
  920.  
  921.     if(*regptr==TRUE && reg_check==784)
  922.       od_exit(10,TRUE);
  923.  
  924.  
  925.     if (single_node==FALSE) {
  926.       ch_flag_d();
  927.       sprintf(numstr, "u%07d.bfa",nCurrentUserNumber);
  928.       if (findfirst(numstr,&fff,0)==0) {
  929.     justfile=ShareFileOpen(numstr,"rb");
  930.     ny_fread(&intval,2,1,justfile);
  931.     fclose(justfile);
  932.     sprintf(numstr,"u%07d.on",intval);
  933.     if (findfirst(numstr,&fff,0)==0) {
  934.       ny_line(402,2,1);
  935.       if(!rip)
  936.         WaitForEnter();
  937.       else
  938.         od_get_answer("\n\r");
  939.       od_exit(10,FALSE);
  940.     } else {
  941.       sprintf(numstr,"u%07d.bfa",nCurrentUserNumber);
  942.       ny_remove(numstr);
  943.     }
  944.       }
  945.     }
  946.   }
  947.  
  948.   //reset users flags
  949.   ch_game_d();
  950.   sprintf(numstr,"u%07d.inf",nCurrentUserNumber);
  951.   if (findfirst(numstr,&fff,0)==0)
  952.     ny_remove(numstr);
  953.   sprintf(numstr,"n%07d.sts",od_control.od_node);
  954.   if (findfirst(numstr,&fff,0)==0)
  955.     ny_remove(numstr);
  956.   sprintf(numstr,"n%07d.stt",od_control.od_node);
  957.   if (findfirst(numstr,&fff,0)==0)
  958.     ny_remove(numstr);
  959.  
  960.  
  961.   od_control.od_before_exit=exit_ops;
  962.   no_kernel=FALSE;
  963.  
  964.   strcpy(uname,od_control.user_name);
  965.   sprintf(od_control.user_name,"%s (%s)",ny_un_emu(cur_user.name,numstr),uname);
  966.   od_control.od_update_status_now=TRUE;
  967.   od_kernal();
  968.  
  969. //  od_set_statusline(STATUS_NONE);
  970. //  od_set_statusline(STATUS_NORMAL);
  971.  
  972.  
  973.   do {
  974.     switch(key=entry_menu())    // Get user's choice
  975.     {
  976.       case 'N':
  977.     newz_ops();
  978.     break;
  979.  
  980.       case 'E':          // If user hit E key
  981.  
  982.     if(*regptr==TRUE && reg_check==784)
  983.       od_exit(10,TRUE);
  984.  
  985.     /*user wuz disabled today so come back tomorrow*/
  986.     if (cur_user.days_not_on==0 && cur_user.alive==UNCONCIOUS) {
  987.       ny_line(401,2,1);
  988. //        od_printf("\n\r\n\r`bright`You heffta wait until tomorrow to play again!\n\r");
  989.       if(!rip)
  990.         WaitForEnter();
  991.       else
  992.         od_get_answer("\n\r");
  993.       od_exit(10,FALSE);
  994.     }
  995.  
  996.     /*user died today*/
  997.     if (cur_user.alive==DEAD) {
  998.       ny_line(400,2,1);
  999. //        od_printf("\n\r\n\r`bright`Dead people are not allowed to play, come back tomorrow to start over!\n\r");
  1000.       if(!rip)
  1001.         WaitForEnter();
  1002.       else
  1003.         od_get_answer("\n\r");
  1004.       od_exit(10,FALSE);
  1005.     }
  1006.  
  1007.     /*user not played today so perform his daily functions*/
  1008.     if (cur_user.days_not_on>0) {
  1009.       cur_user.hitpoints=cur_user.maxhitpoints;
  1010.       cur_user.InterBBSMoves=2;
  1011.       cur_user.wtc=1;
  1012.       cur_user.poison=1;
  1013.       cur_user.drug_high=0;
  1014.       cur_user.turns=max_fights;
  1015.       if (cur_user.std_percent>4)
  1016.         cur_user.std_percent-=4;
  1017.       else {
  1018.         cur_user.std_percent=0;
  1019.         cur_user.std=NONE;
  1020.       }
  1021.  
  1022.       if(cur_user.std>AIDS) cur_user.std=AIDS;
  1023. //        if(cur_user.std<NONE) cur_user.std=NONE;
  1024.       cur_user.hunger+=10;
  1025.       cur_user.sex_today=cur_user.level+1;
  1026.       cur_user.since_got_laid++;
  1027.       if (cur_user.hunger>100) cur_user.hunger=100;
  1028.       if (cur_user.drug_addiction>10) {
  1029.         cur_user.drug_addiction-=10;
  1030.         cur_user.drug_days_since++;
  1031.       } else {
  1032.         cur_user.drug_addiction=0;
  1033.         cur_user.drug_days_since=0;
  1034.       }
  1035.  
  1036. //        od_printf("debug5");
  1037.       //cur_user.std_percent-=10;
  1038.       //if (cur_user.std_percent<=0) cur_user.std_percent=0;
  1039.       /*user wuz beaten  last time, get him back on street*/
  1040.       if (cur_user.alive==UNCONCIOUS) {
  1041.  
  1042. //          od_printf("\n\r\n\r");
  1043. //          ny_send_menu(WAKE_UP,"");
  1044.  
  1045. //           od_printf("debug6");
  1046.  
  1047.         ny_line(403,1,1);
  1048. //          od_printf("\n\r\n\r`bright red`Y`red`er feeling better as you wake up from a comma...\n\r\n\r");
  1049.         cur_user.alive=ALIVE;
  1050.         if(!rip)
  1051.           WaitForEnter();
  1052.         else
  1053.           od_get_answer("\n\r");
  1054.       } else if (cur_user.days_not_on>0) { //user gets 10 points for not getting his ass kicked
  1055.         ny_line(398,1,1);
  1056. //          od_printf("\n\r\n\r`bright red`Y`red`ou get 10 points for not having yer ass kicked...\n\r\n\r");
  1057.         points_raise((unsigned long)10);
  1058.         if(!rip)
  1059.           WaitForEnter();
  1060.         else
  1061.           od_get_answer("\n\r");
  1062.  
  1063.       }
  1064.  
  1065.     }
  1066.  
  1067.     /*reset days not on variable....so user won't get deleted*/
  1068.     cur_user.days_not_on=0;
  1069.  
  1070.     if(*regptr==TRUE && reg_check==784)
  1071.       od_exit(10,TRUE);
  1072.  
  1073.     if (single_node==FALSE) {
  1074.       /*create status file for user*/
  1075.       ch_flag_d();
  1076.       sprintf(numstr,"u%07d.sts",nCurrentUserNumber);
  1077.       justfile = ShareFileOpen(numstr, "wb");
  1078.       ny_fwrite(&cur_user,sizeof(user_rec),1,justfile);
  1079.       fclose(justfile);
  1080.  
  1081.       /*send message to all online users*/
  1082.       if (findfirst("u???????.ON",&ff,0)==0) {
  1083.         do {
  1084.           strcpy(numstr,ff.ff_name);
  1085.           numstr[10]='M';
  1086.           numstr[11]='G';
  1087.           numstr[12]=0;
  1088.           justfile=ShareFileOpen(numstr,"a+b");
  1089.           numstr[0]=27;
  1090.           numstr[1]=10;
  1091.           ny_fwrite(&numstr,51,1,justfile);
  1092.           ny_fwrite(&cur_user.name,25,1,justfile);
  1093.           fclose(justfile);
  1094.         } while (findnext(&ff)==0);
  1095.       }
  1096.       /*User is now on-line!*/
  1097.       sprintf(numstr,"u%07d.on",nCurrentUserNumber);
  1098.       justfile = ShareFileOpen(numstr, "a+b");
  1099.       fclose(justfile);
  1100.  
  1101.     }/* else {
  1102.       justfile = ShareFileOpen("INUSE.FLG", "a+b");
  1103.       fclose(justfile);
  1104.     }  */
  1105.  
  1106.     /*enable online flag in the scr file*/
  1107. //      ch_game_d();
  1108.     points_raise(0);
  1109.     /*justfile = ShareFileOpen(SCR_FILENAME,"r+b");
  1110.     fseek(justfile, (long)cur_user.rank * sizeof(scr_rec),SEEK_SET);
  1111.     ny_fread(&srec,sizeof(scr_rec),1,justfile);
  1112.     srec.online=TRUE;
  1113.     fseek(justfile, (long)cur_user.rank * sizeof(scr_rec),SEEK_SET);
  1114.     ny_fwrite(&srec,sizeof(scr_rec),1,justfile);
  1115.     fclose(justfile);*/
  1116.  
  1117.     /*reset days not on variable....so user won't get deleted*/
  1118.     cur_user.days_not_on=0;
  1119.  
  1120.     /*store cur parms.....*/
  1121.     wrt_sts();
  1122.  
  1123.     oneframe=TRUE;
  1124.     /*display users stats*/
  1125.     if(rip) {
  1126.       od_disp_str("\n\r");
  1127.       od_send_file("FRAME.RIP");
  1128.       od_send_file("FRAME1.RIP");
  1129.     }
  1130.     DisplayStats();
  1131.     WaitForEnter();
  1132.  
  1133.     /*display who's online*/
  1134.     WhosOnline();
  1135.  
  1136.     /*display newzfiles*/
  1137.     newz_ops();
  1138.  
  1139.     oneframe=FALSE;
  1140.  
  1141.     if(reg_check==784 && *regptr==TRUE)
  1142.       registered=FALSE;
  1143.  
  1144.     /*mail read....*/
  1145.        //       od_printf("\n\r\n\r`bright red`R`red`ead yer mail ...(`bright red`[Y]`red`/`bright red`N`red`)");
  1146.       //        key=ny_get_answer("YN\n\r");
  1147. //      if (key=='\n' || key=='\r') key='Y';
  1148. //      od_printf("%c\n\r",key);
  1149. //      if (key=='Y')
  1150.  
  1151.     ny_line(3,2,1);
  1152. //      printf("\n\r1\n\r");
  1153. //      od_printf("\n\r\n\r`bright red`R`red`eading mail...\n\r");
  1154.     read_mail();
  1155.     if(ibbs) read_ibmail();
  1156.  
  1157. //      printf("\n\r13\n\r");
  1158.  
  1159.     /*here goes the streets of ny*/
  1160.     EnterStreet();
  1161.  
  1162.     /*quit game after returning from there*/
  1163.     key='Q';
  1164.     break;
  1165.  
  1166.       case 'L':
  1167.     ListPlayers();
  1168.     break;
  1169.       case 'Y':
  1170.     DisplayStats();
  1171.     WaitForEnter();
  1172.     break;
  1173.     }                            // Loop until quit to BBS
  1174.   } while(key!='Q');
  1175.  
  1176.   od_exit(10,FALSE);              // Again OpenDoors does the rest
  1177.  
  1178.   return 0;
  1179. }
  1180.  
  1181.  
  1182. void
  1183. UserStatus(void)
  1184. {
  1185.   od_set_personality("NY2008");
  1186. }
  1187.  
  1188. void
  1189. set_wildcat(void)
  1190. {
  1191.   od_set_personality("Wildcat");
  1192. }
  1193.  
  1194. void
  1195. ny_pers(unsigned char message)
  1196. {
  1197.   int x,y;
  1198.   char numstr[25];
  1199.  
  1200.  
  1201.   if(message==PEROP_INITIALIZE) {
  1202. //    od_set_personality("Standard");
  1203.     od_control.key_status[0]=15104;
  1204.     od_control.key_status[1]=15360;
  1205.     od_control.key_status[2]=15616;
  1206.     od_control.key_status[3]=15872;
  1207.     od_control.key_status[4]=16128;
  1208.     od_control.key_status[5]=16384;
  1209.     od_control.key_status[6]=17152;
  1210.     od_control.key_status[7]=17408;
  1211.     od_control.od_hot_key[0]=16640;
  1212.     od_control.od_hot_function[0]=set_wildcat;
  1213.     od_control.key_chat=11776;
  1214.     od_control.key_dosshell=9216;
  1215.     od_control.key_drop2bbs=8192;
  1216.     od_control.key_hangup=8960;
  1217.     od_control.key_keyboardoff=9472;
  1218.     od_control.key_lesstime=20480;
  1219.     od_control.key_lockout=9728;
  1220.     od_control.key_moretime=18432;
  1221.     od_control.key_sysopnext=12544;
  1222.   } else if(message==PEROP_DEINITIALIZE) {
  1223.     od_control.od_hot_key[0]=26624;
  1224.     od_control.od_hot_function[0]=UserStatus;
  1225.   } else if(message==PEROP_DISPLAY1 || message==PEROP_UPDATE1) {
  1226.     x=wherex();
  1227.     y=wherey();
  1228.     textbackground(BLUE);
  1229.  
  1230.     textcolor(LIGHTRED);
  1231.  
  1232.     gotoxy(1,24);
  1233.     clreol();
  1234.     ny_un_emu(cur_user.name,numstr);
  1235.     cprintf("  %-46s",numstr);
  1236.     textcolor(WHITE);
  1237.     cprintf(" New York 2008 ");
  1238.  
  1239.     textcolor(LIGHTBLUE);
  1240.     cprintf(" by Franz  ");
  1241.  
  1242.     textcolor(BLACK);
  1243.     cprintf("%s\n\r",ver);
  1244.  
  1245.     clreol();
  1246.     textcolor(LIGHTBLUE);
  1247.     cprintf("                [F2]=Player Status [F3]=Personalities [F9]=Help");
  1248.     gotoxy(x,y);
  1249.  
  1250.   } else if(message==PEROP_DISPLAY2 || message==PEROP_UPDATE2) {
  1251.     x=wherex();
  1252.     y=wherey();
  1253.     textbackground(BLUE);
  1254.     textcolor(WHITE);
  1255.  
  1256.     gotoxy(1,24);
  1257.     clreol();
  1258.     ny_un_emu(cur_user.name,numstr);
  1259.     textcolor(LIGHTRED);
  1260.     cprintf(" %-25s ",numstr);
  1261.     textcolor(WHITE);
  1262.     cprintf("Level: ");
  1263.     textcolor(LIGHTRED);
  1264.     cprintf("%-2d   ",(int)cur_user.level);
  1265.  
  1266.     textcolor(LIGHTBLUE);
  1267.     switch(cur_user.nation) {
  1268.       case HEADBANGER:
  1269.     cprintf("Headbanger     "); break;
  1270.       case HIPPIE:
  1271.     cprintf("Hippie         "); break;
  1272.       case BIG_FAT_DUDE:
  1273.     cprintf("Big Fat Dude   "); break;
  1274.       case CRACK_ADDICT:
  1275.     cprintf("Crack Addict   "); break;
  1276.       case PUNK:
  1277.     cprintf("Punk           "); break;
  1278.     }
  1279.  
  1280.     textcolor(WHITE);
  1281.     cprintf("Sex: ");
  1282.     textcolor(LIGHTRED);
  1283.     if(cur_user.sex==MALE)
  1284.       cprintf("Male");
  1285.     else
  1286.       cprintf("Female");
  1287.  
  1288.     cprintf("\n\r");
  1289.  
  1290.     clreol();
  1291.     textcolor(WHITE);
  1292.     cprintf(" Points: ");
  1293.     textcolor(LIGHTRED);
  1294.     cprintf("%-16s  ",D_Num(cur_user.points));
  1295.     textcolor(WHITE);
  1296.     cprintf("Money: ");
  1297.     textcolor(LIGHTRED);
  1298.     cprintf("%-16s",D_Num(cur_user.money));
  1299.  
  1300.     gotoxy(x,y);
  1301.   } else if(message==PEROP_DISPLAY3 || message==PEROP_UPDATE3) {
  1302.     x=wherex();
  1303.     y=wherey();
  1304.     textbackground(BLUE);
  1305.     textcolor(WHITE);
  1306.  
  1307.     gotoxy(1,24);
  1308.     clreol();
  1309.     cprintf("  These are the personalities NY2008 supports:\n\r");
  1310.  
  1311.     clreol();
  1312.     textcolor(LIGHTBLUE);
  1313.     cprintf("  [F4]=Opendoors Standard [F5]=PCBoard [F6]=Remote Access [F7]=Wildcat ");
  1314.     gotoxy(x,y);
  1315.   } else if(message==PEROP_DISPLAY4) {
  1316.     od_set_personality("Standard");
  1317.   } else if(message==PEROP_DISPLAY5) {
  1318.     od_set_personality("PCBoard");
  1319.   } else if(message==PEROP_DISPLAY6) {
  1320.     od_set_personality("RemoteAccess");
  1321.   } else if(message==PEROP_DISPLAY7 || message==PEROP_UPDATE7) {
  1322.     x=wherex();
  1323.     y=wherey();
  1324.     textbackground(BLUE);
  1325.     textcolor(WHITE);
  1326.  
  1327.     gotoxy(1,24);
  1328.     clreol();
  1329.     cprintf("%s",od_control.od_help_text);
  1330.  
  1331.     clreol();
  1332.     textcolor(LIGHTBLUE);
  1333.     cprintf("  [F1]=Main Status Bar [F2]=User Stats [F3]=Personalities");
  1334.  
  1335.     gotoxy(x,y);
  1336.   }
  1337. }
  1338.  
  1339. void
  1340. dump(void)
  1341. {
  1342.   char key;
  1343.   do {
  1344.     scanf("%c",&key);
  1345.   } while (key!='\n');
  1346. }
  1347.  
  1348.  
  1349. void
  1350. get_bbsname(char bbsname[])
  1351. {
  1352.   int cnt=0;
  1353.   char out[36];
  1354.   int cnto=0;
  1355.  
  1356.   while (bbsname[cnt]!=0 && cnto<35) {
  1357.     if (bbsname[cnt]>='a' && bbsname[cnt]<='z') bbsname[cnt]-=32;
  1358.  
  1359.     if (bbsname[cnt]>='A' && bbsname[cnt]<='Z') {
  1360.       out[cnto]=bbsname[cnt];
  1361.       cnto++;
  1362.     }
  1363.  
  1364.     cnt++;
  1365.   }
  1366.   out[cnto]=0;
  1367.   strcpy(bbsname,out);
  1368. }
  1369.  
  1370.  
  1371.  
  1372. int
  1373. seereg(char bbsname[])
  1374. {
  1375.   return TRUE;
  1376. /*  FILE *justfile;
  1377.   char string4[]="PICATAKY";
  1378.   char kod[26];
  1379.   char string[26] = "ABECEDA";
  1380.   int intval;
  1381.   int cnt;
  1382.   int bbsc;
  1383.   int which;
  1384.   int temp,temp2;
  1385.   int ass=0;
  1386.   char string3[]="HLEDA";
  1387.   char string2[]="KURVA";
  1388.  
  1389.   ass++;
  1390.  
  1391.   strcat(string,string2);
  1392.  
  1393.   ass++;
  1394.  
  1395.   ch_game_d();
  1396.  
  1397.   ass++;
  1398.  
  1399.   justfile=ShareFileOpen(KEY_FILENAME,"rb");
  1400.  
  1401.   ass++;
  1402.  
  1403.   ny_fread(kod,26,1,justfile);
  1404.  
  1405.   if(string[6]=='$') {
  1406.     printf("hehe");
  1407.     od_exit(15,TRUE);
  1408.   }
  1409.  
  1410.   ass++;
  1411.  
  1412.   fclose(justfile);
  1413.  
  1414.   ass++;
  1415.  
  1416.   strcat(string,string3);
  1417.  
  1418.   string3[0]='j';
  1419.  
  1420.   ass++;
  1421.  
  1422.   string2[2]='#';
  1423.  
  1424.   sscanf(kod,"%02d",&intval);
  1425.  
  1426.   ass++;
  1427.  
  1428.   strcat(string,string4);
  1429.  
  1430.  
  1431.   if (intval!=strlen(bbsname)) {
  1432.     string[5]=0;
  1433.     ass=0;
  1434.     string[2]='%';
  1435.     string2[2]='k';
  1436.     string3[4]=3;
  1437.     ass=string[8]+string2[3];
  1438.     ass=string[5] * string[3] * string[2];
  1439.     goto ending;
  1440.   }
  1441.  
  1442.   ass++;
  1443.  
  1444.   intval = kod[0] - '0';
  1445.  
  1446.   ass++;
  1447.  
  1448.   bbsc=0;
  1449.  
  1450.   ass++;
  1451.  
  1452.   which=0;
  1453.  
  1454.   ass++;
  1455.  
  1456.   for (cnt=2;cnt<25;cnt++) {
  1457.     if (bbsname[bbsc]==0) bbsc=0;
  1458.  
  1459.     if(string[4]=='(')
  1460.       string[4]='5';
  1461.  
  1462.  
  1463.     temp2=string[cnt]+intval+bbsname[bbsc];
  1464.  
  1465. //    if (kod[cnt]>'Z') kod[cnt]-=('Z'-'A');
  1466.     temp =  (temp2-'A')/('Z'-'A');
  1467.  
  1468.     temp2 = temp2 - (('Z'-'A') * temp);
  1469.  
  1470.     if(ass!=12) {
  1471.       ass=-8;
  1472.       string[333]=0;
  1473.       string2[333]=0;
  1474.       ass=0;
  1475.       goto ending;
  1476.     }
  1477.  
  1478.     if (kod[cnt]!=temp2) {
  1479.       ass=0;
  1480.       string2[2]=2;
  1481.       string3[2]=2;
  1482.       goto ending;
  1483.     }
  1484.  
  1485.     if (which==0)
  1486.       which =1;
  1487.     else
  1488.       which =0;
  1489.  
  1490.     if(string2[4]=='(')
  1491.       string2[4]='5';
  1492.  
  1493.     intval = kod[which] - '0';
  1494.     bbsc++;
  1495.   }
  1496.  
  1497.   ass++;
  1498.  
  1499.   ending:
  1500.  
  1501.   if (ass==13)
  1502.     ass=TRUE;
  1503.  
  1504.   if(ass==0)
  1505.     reg_check=784;
  1506.  
  1507.   return ass;*/
  1508. }
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515. /*copy end chars  beginning from beg to dest*/
  1516. /*similiar to strncpy*/
  1517. void
  1518. strzcpy(char dest[],const char src[], int beg,int end)
  1519. {
  1520.   int cnt=0;
  1521.   do
  1522.     dest[cnt++]=src[beg++];
  1523.   while (cnt<=end && src[cnt]!=0);
  1524.   dest[cnt]='\0';
  1525. }
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531. void
  1532. ny_kernel(void)
  1533. {
  1534.   if(no_kernel || single_node)
  1535.     return;
  1536.  
  1537.   od_kernal();
  1538.  
  1539.   no_kernel=TRUE;
  1540.  
  1541.   char c_dir;
  1542. //  ffblk ff;
  1543.  
  1544.  
  1545.   c_dir=c_dir_g;
  1546.  
  1547. // if (single_node==FALSE) {
  1548.   ch_flag_d();
  1549.  
  1550. //  bdosptr(0x4E,(void *)&ff,0);
  1551.   //findfirst("MAINT.RUN",&fff,0)
  1552.   if (findfirst("MAINT.RUN",&fff,0)==0) {
  1553.     FILE *justfile;
  1554.     static char numstr[35],numstr2[14];
  1555.     int intval,
  1556.     intused,
  1557.     battled_user = -1;
  1558.  
  1559.   //if(0) {
  1560.     fcloseall();
  1561.     scr_save();
  1562.     od_control.od_disable |= DIS_CARRIERDETECT;
  1563.     ny_line(4,2,0);
  1564.     //Please wait while maintanance runs on another node...
  1565.  
  1566.     while (findfirst("MAINT.RUN",&fff,0)==0) {
  1567.       od_kernal();
  1568.       od_sleep(1);
  1569.     }
  1570.  
  1571.     ny_line(5,1,1);
  1572. //    od_printf("\n\rThanks For Waiting....\n\r");
  1573.  
  1574.     cur_user.days_not_on=1;
  1575.     if (cur_user.rest_where!=NOWHERE) {
  1576.       if (cur_user.hotel_paid_fer>0) cur_user.hotel_paid_fer--;
  1577.       if (cur_user.hotel_paid_fer==0) {
  1578.     ny_line(6,1,1);
  1579. //      od_printf("\n\r`bright`You were kicked out of the hotel\n\r");
  1580.     cur_user.rest_where=NOWHERE;
  1581.       }
  1582.     }
  1583.  
  1584.     sprintf(numstr,"u%07d.bfo",nCurrentUserNumber);
  1585.     if (findfirst(numstr,&fff,0)==0) {
  1586.       justfile=ShareFileOpen(numstr,"rb");
  1587.       ny_fread(&battled_user,2,1,justfile);
  1588.       fclose(justfile);
  1589.       ny_remove(numstr);
  1590.     }
  1591.  
  1592.     sprintf(numstr,"u%07d.cng",nCurrentUserNumber);
  1593.     if (findfirst(numstr,&fff,0)==0) {
  1594.       justfile=ShareFileOpen(numstr,"rb");
  1595.       ny_fread(&intval,2,1,justfile);
  1596.       fclose(justfile);
  1597.  
  1598.       sprintf(numstr,"u%07d.fgg",nCurrentUserNumber);
  1599.       if (findfirst(numstr,&fff,0)==0) {
  1600.  
  1601.     sprintf(numstr,"u%07d.fgg",intval);
  1602.     justfile = ShareFileOpen(numstr,"wb");
  1603.     fclose(justfile);
  1604.     sprintf(numstr,"u%07d.atk",nCurrentUserNumber);
  1605.     sprintf(numstr2,"u%07d.atk",intval);
  1606.     rename(numstr,numstr2);
  1607.       }
  1608.  
  1609.       sprintf(numstr,"u%07d.chl",nCurrentUserNumber);
  1610.       sprintf(numstr2,"u%07d.chl",intval);
  1611.       rename(numstr,numstr2);
  1612.  
  1613.       /*clean up*/
  1614.       sprintf(numstr,"u%07d.*",nCurrentUserNumber);
  1615.       ny_remove(numstr);
  1616.  
  1617.       sprintf(numstr,"u%07d.fgc",nCurrentUserNumber);
  1618.       justfile = ShareFileOpen(numstr, "wb");
  1619.       ny_fwrite(&intval,2,1,justfile);
  1620.       fclose(justfile);
  1621.  
  1622.       nCurrentUserNumber=intval;
  1623.  
  1624.       /* tady se musi zmenit vsechnt flagy......*/
  1625.       sprintf(numstr,"u%07d.sts",nCurrentUserNumber);
  1626.       justfile = ShareFileOpen(numstr, "wb");
  1627.       ny_fwrite(&cur_user,sizeof(user_rec),1,justfile);
  1628.       fclose(justfile);
  1629.  
  1630.  
  1631.       sprintf(numstr,"u%07d.on",nCurrentUserNumber);
  1632.       justfile = ShareFileOpen(numstr, "a+b");
  1633.       fclose(justfile);
  1634.  
  1635.     }
  1636.     if(battled_user>=0) {
  1637.       sprintf(numstr,"u%07d.bfa",battled_user);
  1638.       justfile=ShareFileOpen(numstr,"wb");
  1639.       ny_fwrite(&nCurrentUserNumber,2,1,justfile);
  1640.       fclose(justfile);
  1641.       sprintf(numstr,"u%07d.bfo",nCurrentUserNumber);
  1642.       justfile=ShareFileOpen(numstr,"wb");
  1643.       ny_fwrite(&battled_user,2,1,justfile);
  1644.       fclose(justfile);
  1645.  
  1646.     }
  1647.  
  1648.     // user is in a battle with an offline user
  1649.     //    wrt_sts();
  1650.     od_control.od_disable &=~ DIS_CARRIERDETECT;
  1651.     sprintf(numstr,"u%07d.rnk",nCurrentUserNumber);
  1652.     if (findfirst(numstr,&fff,0)==0) {
  1653.       justfile=ShareFileOpen(numstr,"rb");
  1654.       ny_fread(&cur_user.rank,2,1,justfile);
  1655.       fclose(justfile);
  1656.       ny_remove(numstr);
  1657. //       sprintf(numstr,"del u%07d.rnk",nCurrentUserNumber);
  1658. //       system(numstr);
  1659. //      wrt_sts();
  1660.     }
  1661.     if(no_wrt_sts==FALSE) {
  1662. //      intval=no_kernel;
  1663. //      no_kernel=FALSE;
  1664.       wrt_sts();
  1665. //      no_kernel=intval;
  1666.     }
  1667.  
  1668.     scr_res();
  1669.   }
  1670.  
  1671.   if(c_dir==0) ch_game_d();
  1672.  
  1673.   no_kernel=FALSE;
  1674. }
  1675.  
  1676.  
  1677. void    //the lower kernel .... can use inputs and only done when
  1678. fig_ker(void) //waiting for user not in middle of calcs or whatever
  1679. {             //used for fights and messages and online sex
  1680.   od_kernal();
  1681.  
  1682.   if(no_kernel || single_node)
  1683.     return;
  1684.  
  1685.   char c_dir;
  1686.  
  1687.   char numstr[21],omg[51],nam[25],type = 0;
  1688.   FILE *justfile;
  1689.   int intval;
  1690.  
  1691.   ny_kernel();
  1692.  
  1693.   no_kernel=TRUE;
  1694.   c_dir=c_dir_g;
  1695.  
  1696.  //if (single_node==FALSE) {
  1697.   //if u get an online message
  1698.   ch_flag_d();
  1699.   sprintf(numstr,"u%07d.omg",nCurrentUserNumber);
  1700.   if (findfirst(numstr,&fff,0)==0) {
  1701.  
  1702.     if(!rip) scr_save(); //try to store the screen
  1703.     //if(rip) ny_clr_scr();
  1704.     if(!rip) ny_line(7,2,1);
  1705. //    od_printf("\n\r\n\r`bright`You get a message!\n\r");
  1706.     justfile=ShareFileOpen(numstr,"rb");
  1707.     do {
  1708.       intval=ny_fread(&omg,51,1,justfile);
  1709.       ny_fread(&nam,25,1,justfile);
  1710.  
  1711.       if(omg[0]==27 && intval==1 ) {
  1712.     if(rip) {
  1713.       ny_line(7,2,1);
  1714.       od_get_answer("\n\r");
  1715.     }
  1716.     if(omg[1]<10) {
  1717.       type=1;
  1718.  
  1719.       if(!rip) {
  1720.         ny_disp_emu("`0");
  1721.         ny_disp_emu(nam);
  1722.       } else {
  1723.         ny_un_emu(nam);
  1724.         od_printf("\n\r!|10((%s",nam);
  1725.       }
  1726.  
  1727.       ny_line(357 + omg[1],0,1);
  1728.       if(rip) od_get_answer("\n\r");
  1729.  
  1730.  
  1731.     } else {
  1732.  
  1733.       type=2;
  1734.       if(!rip) {
  1735.         ny_disp_emu("`0");
  1736.         ny_disp_emu(nam);
  1737.       } else {
  1738.         ny_un_emu(nam);
  1739.         od_printf("\n\r!|10((%s",nam);
  1740.       }
  1741.       ny_line(360 + omg[1]-10,0,1);
  1742.       if(rip) od_get_answer("\n\r");
  1743.  
  1744.     }
  1745.       } else {
  1746.  
  1747.     if (intval==1) {
  1748.       if(rip) {
  1749.         scr_save();
  1750.         od_disp_str("\n\r");
  1751.         od_send_file("texti.rip");
  1752.         ny_disp_emu("`%You get a message!\n\r");
  1753.       }
  1754.  
  1755.       ny_disp_emu("`0");
  1756.       ny_disp_emu(omg);
  1757.       if (nam[0]!=0) {
  1758.         ny_line(8,0,0);
  1759. //          ny_disp_emu("   `9F`1rom: `@");
  1760.         ny_disp_emu(nam);
  1761.         od_printf("\n\r");
  1762.       }
  1763.     }
  1764.  
  1765.       }
  1766.     } while (intval==1);
  1767.     fclose(justfile);
  1768.     ny_remove(numstr);
  1769.     //sprintf(numstr,"del u%07d.omg",nCurrentUserNumber);
  1770.     //system(numstr);
  1771.  
  1772.     if(type==1) {
  1773.       ny_line(359,0,0);
  1774.       type=od_get_answer("YN\n\r");
  1775.       if(type=='\n' || type=='\r') type='Y';
  1776.       if(!rip)
  1777.     od_printf("%c\n\r",type);
  1778.       else
  1779.     od_disp_str("\n\r");
  1780.       if(type=='Y')
  1781.     read_mail();
  1782.       ch_flag_d();
  1783.     } else if(rip==FALSE || type==0) {
  1784.       ny_line(1,1,0);
  1785.       od_kernal();
  1786.       od_get_answer("\n\r");
  1787.     }
  1788.  
  1789.     if(rip==FALSE || type==0) scr_res(); //try to restore the screen
  1790.   }
  1791.  
  1792.   ch_flag_d();
  1793.   sprintf(numstr,"u%07d.chl",nCurrentUserNumber);
  1794.   if (findfirst(numstr,&fff,0)==0) {
  1795.     justfile=ShareFileOpen(numstr,"rb");
  1796.     ny_fread(&intval,2,1,justfile);
  1797.     fclose(justfile);
  1798.     scr_save(); //try to store the screen
  1799.     online_fight(&nCurrentUserNumber,&cur_user,intval);
  1800.     scr_res(); //try to restore the screen
  1801.   }
  1802.  
  1803.   if(c_dir==0) ch_game_d();
  1804.   no_kernel=FALSE;
  1805. }
  1806.  
  1807.  
  1808.  
  1809. long
  1810. randomf(long max)
  1811. {
  1812.   long fin,
  1813.        ovrflw;
  1814.  
  1815. //  randomize();
  1816.  
  1817.   fin=random(32767) * random(32767);
  1818.  
  1819.   if (fin<0) fin *= -1;
  1820.  
  1821.   ovrflw=fin/max;
  1822.  
  1823.   fin=fin-(ovrflw*max);
  1824.  
  1825.   return fin;
  1826. }
  1827.  
  1828.  
  1829. void //write current user stats to temp file
  1830. wrt_sts(void)
  1831. {
  1832.   char  numstr[20];
  1833.   FILE *justfile;
  1834.   FILE *scr_file;
  1835.   scr_rec rec;
  1836.   char c_dir;
  1837. //  ffblk ffblk;
  1838.  
  1839.   c_dir=c_dir_g;
  1840.  
  1841.   if(c_dir==1) ch_game_d();
  1842.  
  1843.   no_wrt_sts=TRUE;
  1844.   ny_kernel();
  1845.   no_wrt_sts=FALSE;
  1846.  
  1847.   od_control.od_disable |= DIS_CARRIERDETECT;
  1848.  
  1849.   if(cur_user.std>AIDS) cur_user.std=AIDS;
  1850. //  if(cur_user.std<NONE) cur_user.std=NONE;
  1851.  
  1852.  
  1853.   if(cur_user.alive==UNCONCIOUS) cur_user.days_in_hospital=0;
  1854.  
  1855.   if (single_node==FALSE) {
  1856.     ch_flag_d();
  1857.     sprintf(numstr,"u%07d.rnk",nCurrentUserNumber);
  1858.     if (findfirst(numstr,&fff,0)==0) {
  1859.       justfile=ShareFileOpen(numstr,"rb");
  1860.       ny_fread(&cur_user.rank,2,1,justfile);
  1861.       fclose(justfile);
  1862.       ny_remove(numstr);
  1863. //      sprintf(numstr,"del u%07d.rnk",nCurrentUserNumber);
  1864. //      system(numstr);
  1865.     }
  1866.     sprintf(numstr,"u%07d.sts",nCurrentUserNumber);
  1867.     justfile = ShareFileOpen(numstr, "w+b");
  1868.     ny_fwrite(&cur_user,sizeof(user_rec),1,justfile);
  1869.     fclose(justfile);
  1870.   } else {
  1871.     ch_game_d();
  1872.     WriteCurrentUser();
  1873. //    justfile = fopen(USER_FILENAME, "r+b");
  1874. //    fseek(justfile,nCurrentUserNumber * sizeof(user_rec),SEEK_SET);
  1875. //    fwrite(&cur_user,sizeof(user_rec),1,justfile);
  1876. //    fclose(justfile);
  1877.   }
  1878.   strcpy(rec.name,cur_user.name);
  1879.   rec.nation=cur_user.nation;
  1880.   rec.level=cur_user.level;
  1881.   rec.points=cur_user.points;
  1882.   rec.alive=cur_user.alive;
  1883.   rec.sex=cur_user.sex;
  1884.   rec.user_num=nCurrentUserNumber;
  1885.   rec.online=TRUE;
  1886.  
  1887.   ch_game_d();
  1888.   scr_file=ShareFileOpen(SCR_FILENAME,"r+b");
  1889.   fseek(scr_file, (long)cur_user.rank * sizeof(scr_rec), SEEK_SET);
  1890.   ny_fwrite(&rec, sizeof(scr_rec), 1, scr_file);
  1891.   fclose(scr_file);
  1892.  
  1893.   od_control.od_disable &=~ DIS_CARRIERDETECT;
  1894.   if(c_dir==1)
  1895.     ch_flag_d();
  1896.   else
  1897.     ch_game_d();
  1898. }
  1899.  
  1900.  
  1901.  
  1902.  
  1903. void
  1904. exit_ops(void)
  1905. {
  1906.     FILE* justfile;
  1907.     char numstr[20];
  1908.     scr_rec srec;
  1909. //      ffblk ffblk;
  1910.     int intval;
  1911.  
  1912.     wrt_sts();
  1913.  
  1914.     if(rip) {
  1915.       ny_clr_scr();
  1916.       od_disp_str("\n\r!|10$SBARON$$HKEYON$|#|#|#\n\r");
  1917.       od_control.user_screen_length=temp_len_stor;
  1918.       od_control.user_rip=temp_rip_stor;
  1919.       od_control.user_ansi=temp_avt_stor;
  1920.       od_control.user_avatar=temp_ans_stor;
  1921.     }
  1922.  
  1923.     if (cur_user.hunger>=100) { //user died of hunger today
  1924.       cur_user.hunger=0;
  1925.       Die(2);
  1926.     }
  1927.  
  1928.  
  1929.     /*Print return message*/
  1930.  
  1931.     if (registered) {
  1932.       ny_disp_emu("\n\r\n\r`@R`4eturning you to `@");
  1933.       ny_disp_emu(od_control.system_name);
  1934.       ny_disp_emu("`4...");
  1935.     } else {
  1936.       ny_disp_emu("\n\r\n\r`@R`4eturning you to `%UNREGISTERED BBS`4...\n\r");
  1937.     }
  1938.  
  1939.     //od_set_statusline(STATUS_NONE);
  1940.  
  1941.     strcpy(od_control.user_name,uname);
  1942.  
  1943.         /*user offline, delete temp files and flags*/
  1944.     ch_flag_d();
  1945.     sprintf(numstr,"MNU%d.DAT",od_control.od_node);
  1946.     ny_remove(numstr);
  1947.     sprintf(numstr,"FEV%d.DAT",od_control.od_node);
  1948.     ny_remove(numstr);
  1949.  
  1950.     sprintf(numstr,"u%07d.bfo",nCurrentUserNumber);
  1951.     if (findfirst(numstr,&fff,0)==0) {
  1952.       justfile=ShareFileOpen(numstr,"rb");
  1953.       ny_fread(&intval,2,1,justfile);
  1954.       fclose(justfile);
  1955.       sprintf(numstr,"u%07d.bfa",intval);
  1956.       ny_remove(numstr);
  1957.     }
  1958.  
  1959.     sprintf(numstr,"u%07d.swp",nCurrentUserNumber);
  1960.     if (findfirst(numstr,&fff,0)==0) {
  1961.       justfile=ShareFileOpen(numstr,"rb");
  1962.       ny_fread(&cur_user.arm,2,1,justfile);
  1963.       fclose(justfile);
  1964.       ny_remove(numstr);
  1965.     }
  1966.  
  1967.     sprintf(numstr,"u%07d.*",nCurrentUserNumber);
  1968.     if (findfirst(numstr,&fff,0)==0) {
  1969.     //  sprintf(numstr,"u%07d.*",nCurrentUserNumber);
  1970.       ny_remove(numstr);
  1971.     }
  1972.  
  1973.     /*write stats to usr file*/
  1974.     WriteCurrentUser();
  1975.  
  1976.  
  1977.     if(single_node==FALSE) {
  1978.       ch_flag_d();
  1979.       /*send message to all online users*/
  1980.       if (findfirst("u???????.ON",&ff,0)==0) {
  1981.         do {
  1982.           strcpy(numstr,ff.ff_name);
  1983.           numstr[10]='M';
  1984.           numstr[11]='G';
  1985.           numstr[12]=0;
  1986.           justfile=ShareFileOpen(numstr,"a+b");
  1987.           numstr[0]=27;
  1988.           numstr[1]=11;
  1989.           ny_fwrite(&numstr,51,1,justfile);
  1990.           ny_fwrite(&cur_user.name,25,1,justfile);
  1991.           fclose(justfile);
  1992.         } while (findnext(&ff)==0);
  1993.       }
  1994.     }
  1995.     strcpy(srec.name,cur_user.name);
  1996.     srec.nation=cur_user.nation;
  1997.     srec.level=cur_user.level;
  1998.     srec.points=cur_user.points;
  1999.     srec.alive=cur_user.alive;
  2000.     srec.sex=cur_user.sex;
  2001.     srec.user_num=nCurrentUserNumber;
  2002.     srec.online=FALSE;
  2003.  
  2004.     /*disable online flag in the scr file*/
  2005.     ch_game_d();
  2006.     justfile = ShareFileOpen(SCR_FILENAME,"r+b");
  2007.     fseek(justfile, (long)cur_user.rank * sizeof(scr_rec),SEEK_SET);
  2008.     ny_fwrite(&srec,sizeof(scr_rec),1,justfile);
  2009.     fclose(justfile);
  2010.  
  2011.     /*create score files*/
  2012.     if (do_scr_files==TRUE) {
  2013.       ny_line(9,2,0);
  2014.       MakeFiles();
  2015.       ny_line(10,0,1);
  2016.     }
  2017.  
  2018.     for(int i=0;i<badwordscnt;i++)
  2019.       free(badwords[i]);
  2020. }
  2021.  
  2022.  
  2023.  
  2024. void
  2025. Maintanance(void)
  2026. {
  2027.     FILE *fpUserFile;
  2028.     FILE *scr_file;
  2029.     FILE *justfile;
  2030.     FILE *njustfile;
  2031.     FILE *delfile;
  2032.     char numstr[45],numstr2[14];
  2033.     scr_rec scr_user;
  2034.     user_rec urec;
  2035.     int intval;
  2036.     int user_num=0;
  2037.     int user_num_w=0;
  2038.     date    today,
  2039.         lastday;
  2040. //      struct ffblk ffblk;
  2041.  
  2042.  
  2043.   if(registered==FALSE) bank_interest=0;
  2044.  
  2045.   if(rip) ny_clr_scr();
  2046.  
  2047.   ny_line(11,2,1);
  2048. //  od_printf("\n\r\n\r`cyan`### Checking for maintanance running\n\r");
  2049.  
  2050.   ch_flag_d();
  2051.   if (findfirst("MAINT.RUN",&fff,0)!=0) {
  2052.  
  2053.     no_kernel=TRUE;
  2054.  
  2055.  
  2056.     if(forced_maint==FALSE) {
  2057.       ny_line(12,0,1);
  2058. //        od_printf("### Checking for last maintanance\n\r");
  2059.  
  2060.       getdate(&today);
  2061.  
  2062.       ch_game_d();
  2063.       if (findfirst("NYLAST.MNT",&fff,0)==0) {
  2064.         fpUserFile = ShareFileOpen("NYLAST.MNT", "r+b");
  2065.         ny_fread(&lastday, sizeof(date), 1, fpUserFile);
  2066.         if (lastday.da_year==today.da_year && lastday.da_mon==today.da_mon && lastday.da_day==today.da_day) {
  2067.           fclose(fpUserFile);
  2068.           return;
  2069.         }
  2070.  
  2071. /*        if (do_maint==FALSE) {
  2072.         sprintf(numstr,"u%07d.NMT",nCurrentUserNumber);
  2073.         if(findfirst(numstr,&fff,0)!=0)
  2074.           cur_user.days_not_on++;
  2075.         fclose(fpUserFile);
  2076.         return;
  2077.       }*/
  2078.         ch_flag_d();
  2079.         justfile = ShareFileOpen("MAINT.RUN", "a+b");
  2080.         fclose(justfile);
  2081.         fseek(fpUserFile, (long)0, SEEK_SET);
  2082.         ny_fwrite(&today, sizeof(date), 1, fpUserFile);
  2083.         fclose(fpUserFile);
  2084.       } else {
  2085. /*        if (do_maint==FALSE) {
  2086.         cur_user.days_not_on+=1;
  2087.         return;
  2088.       }*/
  2089.         ch_flag_d();
  2090.         justfile = ShareFileOpen("MAINT.RUN", "wb");
  2091.         fclose(justfile);
  2092.         ch_game_d();
  2093.         fpUserFile = ShareFileOpen("NYLAST.MNT", "wb");
  2094.         ny_fwrite(&today, sizeof(date), 1, fpUserFile);
  2095.         fclose(fpUserFile);
  2096.       }
  2097.     } else {
  2098.       ch_flag_d();
  2099.       justfile = ShareFileOpen("MAINT.RUN", "a+b");
  2100.       fclose(justfile);
  2101.       getdate(&today);
  2102.       ch_game_d();
  2103.       fpUserFile = ShareFileOpen("NYLAST.MNT", "wb");
  2104.       ny_fwrite(&today, sizeof(date), 1, fpUserFile);
  2105.       fclose(fpUserFile);
  2106.     }
  2107.     ch_game_d();
  2108.     if (findfirst("NYGAME.DAY",&fff,0)==0) {
  2109.       justfile=ShareFileOpen("NYGAME.DAY","r+b");
  2110.       ny_fread(&intval,2,1,justfile);
  2111.       intval++;
  2112.       fseek(justfile,0,SEEK_SET);
  2113.       ny_fwrite(&intval,2,1,justfile);
  2114.       fclose(justfile);
  2115.     } else {
  2116.       ch_game_d();
  2117.       justfile=ShareFileOpen("NYGAME.DAY","wb");
  2118.       intval=1;
  2119.       ny_fwrite(&intval,2,1,justfile);
  2120.       fclose(justfile);
  2121.     }
  2122.  
  2123.     ny_line(13,0,1);
  2124. //      od_printf("### Running daily maintance\n\r");
  2125.     //get rid of all the played today files ....
  2126.     ch_flag_d();
  2127.     if(findfirst("*.tdp",&fff,0)==0)
  2128.       ny_remove("*.tdp");
  2129.  
  2130.     ch_game_d();
  2131.     if (findfirst("nynews.yes",&fff,0)==0) ny_remove("nynews.yes");
  2132.     if (findfirst("nynews.tod",&fff,0)==0) copyfile("nynews.tod","nynews.yes");
  2133. //        ny_remove("nynews.tod");
  2134.   //    }
  2135.     fpUserFile = ShareFileOpen("nynews.tod", "w+b");
  2136.     fclose(fpUserFile);
  2137.     fpUserFile = ShareFileOpen("nynews.yes", "a+b");
  2138.     fclose(fpUserFile);
  2139.  
  2140.  
  2141.     /* Begin with the current user record number set to 0. */
  2142.     user_num = 0;
  2143.     user_num_w = 0;
  2144.  
  2145.     /*delete all change files cuz they're not needed and will mess up*/
  2146.     ch_flag_d();
  2147.     if (findfirst("*.cng",&fff,0)==0) ny_remove("*.cng");
  2148.  
  2149.     /*if fast_mail_index founddelete it*/
  2150. //      if (findfirst("fastmail.idx",&fff,0)==0) ny_remove("fastmail.idx");
  2151.  
  2152.     /*delete scores index file*/
  2153.     ch_game_d();
  2154.     //  if (findfirst(SCR_FILENAME,&fff,0)==0) ny_remove(SCR_FILENAME);
  2155.  
  2156. //      if (findfirst("nybak.usr",&fff,0)==0) ny_remove("nybak.usr");
  2157.     copyfile("ny2008.usr","nybak.usr");
  2158.   //    ny_remove(USER_FILENAME);
  2159.     scr_file = ShareFileOpen(SCR_FILENAME, "wb");
  2160.     justfile = ShareFileOpen("nybak.usr", "rb");
  2161.     fpUserFile = ShareFileOpen(USER_FILENAME, "wb");
  2162.  
  2163.     /* Loop for each record in the file */
  2164.     ny_line(14,0,1);
  2165. //      od_printf("### Packing and updating user file and creating scorefile\n\r");
  2166.     while(ny_fread(&urec, sizeof(user_rec), 1, justfile) == 1)
  2167.         {
  2168.           if (((++urec.days_not_on)<=delete_after) && urec.alive!=DEAD) {
  2169.             urec.rank=user_num_w;
  2170.  
  2171.             urec.bank *= 1.0+ (bank_interest/100.0);
  2172.  
  2173.             if (urec.alive==UNCONCIOUS && (urec.days_in_hospital++)>=2 ) {
  2174.               urec.alive=ALIVE;
  2175.               urec.hitpoints=urec.maxhitpoints;
  2176.               urec.days_in_hospital=0;
  2177.               od_printf("### %s kicked out of the hospital\n\r",ny_un_emu(urec.name,numstr));
  2178.             }
  2179.             if (urec.rest_where!=NOWHERE) {
  2180.               if (urec.hotel_paid_fer==0) {
  2181.             urec.rest_where=NOWHERE;
  2182.             od_printf("### %s was kicked out of the hotel\n\r",ny_un_emu(urec.name,numstr));
  2183.               } else {
  2184.             urec.hotel_paid_fer--;
  2185.               }
  2186.             }
  2187.             fseek(fpUserFile, (long)user_num_w * sizeof(user_rec), SEEK_SET);
  2188.             ny_fwrite(&urec, sizeof(user_rec), 1, fpUserFile);
  2189.             //check if on-line
  2190.             if (single_node==FALSE) {
  2191.               ch_flag_d();
  2192.               sprintf(numstr, "u%07d.bfa",user_num); //user in a battle
  2193.               if (findfirst(numstr,&fff,0)==0) {
  2194.             if (user_num!=user_num_w) {
  2195.               njustfile = ShareFileOpen(numstr, "rb");
  2196.               ny_fread(&intval,2,1,njustfile);
  2197.               fclose(njustfile);
  2198.               ny_remove(numstr);
  2199.               sprintf(numstr, "u%07d.bfo",intval);
  2200.               njustfile = ShareFileOpen(numstr, "wb");
  2201.               ny_fwrite(&user_num_w,2,1,njustfile);
  2202.               fclose(njustfile);
  2203.               //sprintf(numstr, "del u%07d.bfa",user_num);
  2204.               //system(numstr); //see above!
  2205.             }
  2206.               }
  2207.               sprintf(numstr,"u%07d.on",user_num);
  2208.               if (findfirst(numstr,&fff,0)==0) {
  2209.             scr_user.online=TRUE;
  2210.             sprintf(numstr,"u%07d.sts",user_num);
  2211.             njustfile = ShareFileOpen(numstr, "r+b");
  2212.             ny_fread(&urec,sizeof(user_rec),1,njustfile);
  2213.             fclose(njustfile);
  2214.             if (user_num!=user_num_w) {
  2215.               ch_game_d();
  2216.               sprintf(numstr,"u%07d.inf",user_num);
  2217.               if (findfirst(numstr,&fff,0)==0) {
  2218.                 sprintf(numstr,"u%07d.inf",user_num);
  2219.                 sprintf(numstr2,"u%07d.inf",user_num_w);
  2220.                 rename(numstr,numstr2);
  2221.               }
  2222.               ch_flag_d();
  2223.               sprintf(numstr,"u%07d.cng",user_num);
  2224.               njustfile = ShareFileOpen(numstr, "a+b");
  2225.               ny_fwrite(&user_num_w,2,1,njustfile);
  2226.               fclose(njustfile);
  2227.             }
  2228.               } else {
  2229.             scr_user.online=FALSE;
  2230.               }
  2231.             } else {
  2232.               scr_user.online=FALSE;
  2233.             }
  2234.  
  2235.  
  2236.  
  2237.             strcpy(scr_user.name,urec.name);
  2238.             scr_user.nation=urec.nation;
  2239.             scr_user.level=urec.level;
  2240.             scr_user.points=urec.points;
  2241.             scr_user.alive=urec.alive;
  2242.             scr_user.sex=urec.sex;
  2243.             scr_user.user_num=user_num_w;
  2244.  
  2245.  
  2246.             ny_fwrite(&scr_user, sizeof(scr_rec), 1, scr_file);
  2247.  
  2248.             user_num_w++;
  2249.           } else {
  2250.             od_printf("### Deleting (%s)\n\r",ny_un_emu(urec.name,numstr));
  2251.             ny_remove("SENTLIST.PL");
  2252.             /*ch_game_d();
  2253.             delfile=ShareFileOpen("NYUSER.DEL","a+b");
  2254.             ny_fwrite(&urec.bbsname,36,1,delfile);
  2255.             fclose(delfile);*/
  2256.           }
  2257.  
  2258.           /* Move user record number to next user record. */
  2259.           user_num++;
  2260.         }
  2261.     fclose(fpUserFile);
  2262.     fclose(justfile);
  2263.     fclose(scr_file);
  2264.     ny_line(15,0,1);
  2265. //      od_printf("### User file done...\n\r");
  2266.     ny_line(16,0,1);
  2267. //      od_printf("### Sorting SCR file...\n\r");
  2268.     SortScrFile(-1,user_num_w);
  2269.     if (single_node==FALSE) ChangeOnlineRanks();
  2270.     ny_line(17,0,1);
  2271. //      od_printf("### Checking for mail index file...\n\r");
  2272.     ch_game_d();
  2273.     if (findfirst(MAIL_INDEX,&fff,0)==0) {
  2274.  
  2275.       mail_idx_type mail_idx;
  2276. //        long fileposr,fileposw;
  2277.       long mlinew,mliner;
  2278.       long cnt;
  2279.       char line[80];
  2280.       FILE *rdonly1;
  2281.       FILE *rdonly2;
  2282.       ch_game_d();
  2283.       //if (findfirst("NYUSER.DEL",&fff,0)==0) {
  2284.         cnt=0;
  2285.         ny_line(18,0,1);
  2286. //          od_printf("### Packing mail index file...\n\r");
  2287.         justfile=ShareFileOpen(MAIL_INDEX,"r+b");
  2288.         fpUserFile=ShareFileOpen(USER_FILENAME,"rb");
  2289.         ny_line(19,0,1);
  2290. //          od_printf("### Deleting messages for dead users...\n\r");
  2291.         while (ny_fread(&mail_idx,sizeof(mail_idx_type),1,justfile)==1) {
  2292.           fseek(fpUserFile,(long)0,SEEK_SET);
  2293.           mail_idx.deleted=TRUE;
  2294.           while(ny_fread(&urec,sizeof(user_rec),1,fpUserFile)==1) {
  2295.         if (strcmp(urec.bbsname,mail_idx.recverI)==0) {
  2296.           mail_idx.deleted=FALSE;
  2297.           break;
  2298.         }
  2299.           }
  2300.           if(mail_idx.deleted==TRUE) {
  2301.         fseek(justfile,(long)cnt*sizeof(mail_idx_type),SEEK_SET);
  2302.         ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,justfile);
  2303.           }
  2304.           cnt++;
  2305.         }
  2306.         fclose(justfile);
  2307.         fclose(fpUserFile);
  2308.         //ny_remove("NYUSER.DEL");
  2309.       //}
  2310.       ch_game_d();
  2311.       copyfile("NY2008.MSX","NYBACK.MSX");
  2312.       copyfile("NY2008.MSG","NYBACK.MSG");
  2313. //        ny_remove(MAIL_INDEX);
  2314.   //      ny_remove(MAIL_FILENAME);
  2315.  
  2316.       rdonly1=ShareFileOpen("NYBACK.MSX","rb");
  2317.       rdonly2=ShareFileOpen("NYBACK.MSG","rb");
  2318.       justfile=ShareFileOpen(MAIL_INDEX,"wb");
  2319.       njustfile=ShareFileOpen(MAIL_FILENAME,"wb");
  2320.       mlinew=0;
  2321.       mliner=0;
  2322. //        fileposr=0;
  2323. //        fileposw=0;
  2324.       ny_line(20,0,1);
  2325. //        od_printf("### Deleting read messages...\n\r");
  2326.       while (ny_fread(&mail_idx,sizeof(mail_idx_type),1,rdonly1)==1) {
  2327.         if (mail_idx.deleted==FALSE) {
  2328.           mail_idx.location=mlinew;
  2329. //            fseek(justfile,fileposw,SEEK_SET);
  2330.           ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,justfile);
  2331.           cnt=0;
  2332.  
  2333.           fseek(rdonly2,mliner*80,SEEK_SET);
  2334.           while (cnt<mail_idx.length) {
  2335.         ny_fread(&line,80,1,rdonly2);
  2336. //              fseek(njustfile,mlinew,SEEK_SET);
  2337.         ny_fwrite(&line,80,1,njustfile);
  2338.         cnt++;
  2339.           }
  2340.           mlinew+=mail_idx.length;
  2341. //            fileposw+=sizeof(mail_idx_type);
  2342.         }// else {
  2343.         //  od_printf(".");
  2344.         //}
  2345.         mliner+=mail_idx.length;
  2346. //          fileposr+=sizeof(mail_idx_type);
  2347. //          fseek(justfile,fileposr,SEEK_SET);
  2348.       }
  2349.       fclose(justfile);
  2350.       fclose(njustfile);
  2351.       fclose(rdonly1);
  2352.       fclose(rdonly2);
  2353.       //od_printf("\n\r");
  2354.       ny_line(21,0,1);
  2355. //        od_printf("### Mail file done...\n\r");
  2356.     }
  2357.     if (findfirst("NYIBBS.MIN",&fff,0)==0) {
  2358.       ibbs_mail_type ibmail;
  2359. //        long fileposr,fileposw;
  2360. //        long mlinew,mliner;
  2361.       long cnt;
  2362. //        char line[80];
  2363.       FILE *rdonly1;
  2364. //        FILE *rdonly2;
  2365.       ch_game_d();
  2366.       //if (findfirst("NYUSER.DEL",&fff,0)==0) {
  2367.         cnt=0;
  2368.         ny_line(447,0,1);
  2369. //          od_printf("### Packing IBBS mail index file...\n\r");
  2370.         justfile=ShareFileOpen("NYIBBS.MIN","r+b");
  2371.         fpUserFile=ShareFileOpen(USER_FILENAME,"rb");
  2372.         ny_line(19,0,1);
  2373. //          od_printf("### Deleting messages for dead users...\n\r");
  2374.         while (ny_fread(&ibmail,sizeof(ibbs_mail_type),1,justfile)==1) {
  2375.           fseek(fpUserFile,(long)0,SEEK_SET);
  2376.           ibmail.deleted=TRUE;
  2377.           while(ny_fread(&urec,sizeof(user_rec),1,fpUserFile)==1) {
  2378.         if (strcmp(urec.bbsname,ibmail.recverI)==0) {
  2379.           ibmail.deleted=FALSE;
  2380.           break;
  2381.         }
  2382.           }
  2383.           if(ibmail.deleted==TRUE) {
  2384.         fseek(justfile,(long)cnt*sizeof(ibbs_mail_type),SEEK_SET);
  2385.         ny_fwrite(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  2386.           }
  2387.           cnt++;
  2388.         }
  2389.         fclose(justfile);
  2390.         fclose(fpUserFile);
  2391.         //ny_remove("NYUSER.DEL");
  2392.       //}
  2393.       ch_game_d();
  2394.       copyfile("NYIBBS.MIN","NYIBBACK.MIN");
  2395. //        ny_remove("NYIBBS.MIN");
  2396.  
  2397.       rdonly1=ShareFileOpen("NYIBBACK.MIN","rb");
  2398.       justfile=ShareFileOpen("NYIBBS.MIN","wb");
  2399.       ny_line(20,0,1);
  2400. //        od_printf("### Deleting read messages...\n\r");
  2401.       while (ny_fread(&ibmail,sizeof(ibbs_mail_type),1,rdonly1)==1) {
  2402.         if (ibmail.deleted==FALSE) {
  2403.  
  2404.           ny_fwrite(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  2405.         }
  2406.       }
  2407.       fclose(justfile);
  2408.       fclose(rdonly1);
  2409.       ny_line(21,0,1);
  2410. //        od_printf("### Mail file done...\n\r");
  2411.     }
  2412.  
  2413.  
  2414.     ny_line(22,0,1);
  2415. //      od_printf("### Cleaning up...\n\r");
  2416.     ch_game_d();
  2417.     if (maint_exec[0]!=0) {
  2418.       ny_line(23,0,1);
  2419. //        od_printf("### Executing custom maintanance program\n\r");
  2420.       od_spawn(maint_exec);
  2421.     }
  2422.     if (findfirst("3rdmnt.bat",&fff,0)==0) {
  2423.       ny_line(23,0,1);
  2424. //        od_printf("### Executing custom maintanance program\n\r");
  2425.       CreateDropFile(FALSE);
  2426.       od_spawn("3rdmnt.bat");
  2427.       ny_remove("3rdmnt.inf");
  2428.     }
  2429.  
  2430.     ch_flag_d();
  2431.     ny_remove("MAINT.RUN");
  2432.     no_kernel=FALSE;
  2433.     ny_remove("nyerr~~~.~~~");
  2434.   }
  2435. }
  2436.  
  2437.  
  2438.  
  2439.  
  2440. void
  2441. ChangeOnlineRanks(void)
  2442. {
  2443.   if (findfirst("u???????.ON",&ff,0)==0) {
  2444.     FILE *justfile;
  2445.     char numstr[20];
  2446.     int intval;
  2447.     user_rec urec;
  2448.     ch_flag_d();
  2449.     do {
  2450.       strcpy(numstr,ff.ff_name);
  2451.       numstr[0]='0';
  2452.       numstr[8]=0;
  2453.       sscanf(numstr,"%d",&intval);
  2454.       ch_game_d();
  2455.       justfile=ShareFileOpen(USER_FILENAME,"rb");
  2456.       fseek(justfile,(long)intval*sizeof(user_rec),SEEK_SET);
  2457.       ny_fread(&urec,sizeof(user_rec),1,justfile);
  2458.       fclose(justfile);
  2459.       strcpy(numstr,ff.ff_name);
  2460.       numstr[9]='R';
  2461.       numstr[10]='N';
  2462.       numstr[11]='K';
  2463.       numstr[12]=0;
  2464.       ch_flag_d();
  2465.       justfile=ShareFileOpen(numstr,"wb");
  2466.       ny_fwrite(&urec.rank,2,1,justfile);
  2467.       fclose(justfile);
  2468.  
  2469.     } while (findnext(&ff)==0);
  2470.   }
  2471. }
  2472.  
  2473.  
  2474.  
  2475. void
  2476. CrashRecovery(void)
  2477. {
  2478.   FILE *fpUserFile;
  2479.   FILE *scr_file;
  2480.   FILE *justfile;
  2481.   FILE *bakfile;
  2482.   char numstr[36];
  2483.   scr_rec scr_user;
  2484.   user_rec urec;
  2485.   int intval;
  2486.   int user_num=0;
  2487. //  struct ffblk ffblk;
  2488.  
  2489.   no_kernel=TRUE;
  2490.  
  2491.   ny_line(24,0,1);
  2492. //  od_printf("`cyan`### Running Crash Recovery\n\r");
  2493.  
  2494.   /* Begin with the current user record number set to 0. */
  2495.   user_num = 0;
  2496.  
  2497.   /*delete scores index file*/
  2498.   ch_game_d();
  2499.   if (findfirst(SCR_FILENAME,&fff,0)==0) ny_remove(SCR_FILENAME);
  2500.  
  2501.   /*delete maintanance running flag file*/
  2502.   ch_flag_d();
  2503.   if (findfirst("maint.run",&fff,0)==0) ny_remove("maint.run");
  2504.   /*delete all change files cuz they're not needed and will mess up*/
  2505.   if (findfirst("*.cng",&fff,0)==0) ny_remove("*.cng");
  2506.  
  2507.   ch_game_d();
  2508.   scr_file = ShareFileOpen(SCR_FILENAME, "wb");
  2509.   copyfile("ny2008.usr","nybak.usr");
  2510. //  ny_remove("ny2008.usr");
  2511.   fpUserFile = ShareFileOpen(USER_FILENAME, "wb");
  2512.   bakfile = ShareFileOpen("nybak.usr", "rb");
  2513.  
  2514.   /* Loop for each record in the file */
  2515.   ny_line(25,0,1);
  2516. //  od_printf("### Updating (no maintanance) user file and creating scorefile\n\r");
  2517.   ch_flag_d();
  2518.   while(ny_fread(&urec, sizeof(user_rec), 1, bakfile) == 1 && user_num<=MAX_USERS) {
  2519. //    ch_flag_d();
  2520.     sprintf(numstr, "u%07d.on",user_num);
  2521.     if (findfirst(numstr,&fff,0)==0) {
  2522.       sprintf(numstr, "u%07d.sts",user_num);
  2523.       if (findfirst(numstr,&fff,0)==0) {
  2524.     justfile = ShareFileOpen(numstr, "rb");
  2525.     if(ny_fread(&urec, sizeof(user_rec), 1, justfile)!=1) {
  2526.       fseek(bakfile, (long)user_num * sizeof(user_rec), SEEK_SET);
  2527.       ny_fread(&urec, sizeof(user_rec), 1, bakfile);
  2528.     }
  2529.     fclose(justfile);
  2530.       }
  2531.     }
  2532.     sprintf(numstr, "u%07d.*",user_num);
  2533.     if (findfirst(numstr,&fff,0)==0) {
  2534. //      ny_remove(numstr);
  2535.       sprintf(numstr, "u%07d.*",user_num);
  2536.       ny_remove(numstr);
  2537.     }
  2538.     urec.rank=user_num;
  2539. //    fseek(fpUserFile, (long)user_num * sizeof(user_rec), SEEK_SET);
  2540.     ny_fwrite(&urec, sizeof(user_rec), 1, fpUserFile);
  2541.  
  2542.     //offline records all
  2543.     scr_user.online=FALSE;
  2544.     strcpy(scr_user.name,urec.name);
  2545.     scr_user.nation=urec.nation;
  2546.     scr_user.level=urec.level;
  2547.     scr_user.points=urec.points;
  2548.     scr_user.alive=urec.alive;
  2549.     scr_user.sex=urec.sex;
  2550.     scr_user.user_num=user_num;
  2551.     ny_fwrite(&scr_user, sizeof(scr_rec), 1, scr_file);
  2552.  
  2553.     /* Move user record number to next user record. */
  2554.     user_num++;
  2555.   }
  2556.   fclose(fpUserFile);
  2557.   fclose(scr_file);
  2558.   fclose(bakfile);
  2559.   ny_line(26,0,1);
  2560. //  od_printf("### User file done...\n\r");
  2561.   ny_line(27,0,1);
  2562. //  od_printf("### Sorting new SCR file...\n\r");
  2563.   SortScrFile(-1,user_num);
  2564.   ny_remove("mnu*.dat");
  2565.   ny_remove("fev*.dat");
  2566.   ny_remove("n???????.sts");
  2567.   ny_remove("n???????.stt");
  2568. //  ny_remove("nyerr~~~.~~~");
  2569.   no_kernel=FALSE;
  2570. }
  2571.  
  2572.  
  2573.  
  2574.  
  2575. void
  2576. SortScrFile(int usr,int max) // pebble sorting of scorefile
  2577. {
  2578.   FILE *justfile;
  2579.   FILE *scr_file;
  2580.   FILE *fpUserFile;
  2581.   FILE *njustfile;
  2582.   int crnt1,crnt2,cnt,sorted;
  2583.   scr_rec rec[2];
  2584.   user_rec urec;
  2585.   char numstr[20];
  2586. //  ffblk ffblk;
  2587.  
  2588.   if (usr==-1) {
  2589.     ch_game_d();
  2590.     scr_file=ShareFileOpenAR(SCR_FILENAME,"r+b");
  2591.     fpUserFile=ShareFileOpenAR(USER_FILENAME,"r+b");
  2592.     do {
  2593.       cnt=1;
  2594.       sorted=TRUE;
  2595.  
  2596.  
  2597.       while (cnt<max) {
  2598.     fseek(scr_file, (long)(cnt-1) * sizeof(scr_rec), SEEK_SET);
  2599.     ny_fread(&rec[0], sizeof(scr_rec), 1, scr_file);
  2600.  
  2601.  
  2602.     fseek(scr_file, (long)cnt * sizeof(scr_rec), SEEK_SET);
  2603.     if (ny_fread(&rec[1], sizeof(scr_rec), 1, scr_file)!=1) {
  2604.       fcloseall();
  2605.       return;
  2606.     }
  2607.  
  2608.     if (rec[0].points<rec[1].points) { // switch records
  2609.  
  2610.       sorted=FALSE; // run another round
  2611.       fseek(fpUserFile, (long)rec[0].user_num * sizeof(user_rec), SEEK_SET);
  2612.       ny_fread(&urec,sizeof(user_rec),1,fpUserFile);
  2613.       urec.rank=cnt;
  2614.  
  2615.       fseek(fpUserFile, (long)rec[0].user_num * sizeof(user_rec), SEEK_SET);
  2616.       ny_fwrite(&urec,sizeof(user_rec),1,fpUserFile);
  2617.  
  2618.       fseek(fpUserFile, (long)rec[1].user_num * sizeof(user_rec), SEEK_SET);
  2619.       ny_fread(&urec,sizeof(user_rec),1,fpUserFile);
  2620.       urec.rank=cnt-1;
  2621.  
  2622.       fseek(fpUserFile, (long)rec[1].user_num * sizeof(user_rec), SEEK_SET);
  2623.       ny_fwrite(&urec,sizeof(user_rec),1,fpUserFile);
  2624.  
  2625.       do fseek(scr_file, (long)(cnt-1) * sizeof(scr_rec), SEEK_SET);
  2626.       while (ny_fwrite(&rec[1],sizeof(scr_rec),1,scr_file)!=1);
  2627.  
  2628.       do fseek(scr_file, (long)cnt * sizeof(scr_rec), SEEK_SET);
  2629.       while (ny_fwrite(&rec[0],sizeof(scr_rec),1,scr_file)!=1);
  2630.  
  2631.     }
  2632.     cnt++;
  2633.       }
  2634.       fseek(fpUserFile, (long)0, SEEK_SET);
  2635.       fseek(scr_file, (long)0, SEEK_SET);
  2636.       max--;
  2637.     } while (sorted==FALSE);
  2638.     fclose(scr_file);
  2639.     fclose(fpUserFile);
  2640.  
  2641.   } else { // sort in a certain user either current or an offline user
  2642.     ch_game_d();
  2643.    // if(no_kernel==TRUE) {
  2644.       scr_file=ShareFileOpenAR(SCR_FILENAME,"r+b");
  2645.       fpUserFile=ShareFileOpenAR(USER_FILENAME,"r+b");
  2646. /*    } else {
  2647.       no_kernel=TRUE;
  2648.       scr_file=ShareFileOpenAR(SCR_FILENAME,"r+b");
  2649.       fpUserFile=ShareFileOpenAR(USER_FILENAME,"r+b");
  2650.       no_kernel=FALSE;
  2651.     }*/
  2652.  
  2653.     if (usr==nCurrentUserNumber) {
  2654.       cnt=cur_user.rank;
  2655.     } else {
  2656.       fseek(fpUserFile, (long)usr * sizeof(user_rec), SEEK_SET);
  2657.       ny_fread(&urec, sizeof(user_rec), 1, fpUserFile);
  2658.       cnt=urec.rank;
  2659.     }
  2660.     //od_printf("\n\r\n\r%d\n\r\n\r",cnt);
  2661.  
  2662.     crnt1=0;
  2663.     crnt2=1;
  2664.  
  2665.     strcpy(rec[crnt1].name,cur_user.name);
  2666.     rec[crnt1].nation=cur_user.nation;
  2667.     rec[crnt1].level=cur_user.level;
  2668.     rec[crnt1].points=cur_user.points;
  2669.     rec[crnt1].alive=cur_user.alive;
  2670.     rec[crnt1].sex=cur_user.sex;
  2671.     rec[crnt1].user_num=nCurrentUserNumber;
  2672.     rec[crnt1].online=TRUE;
  2673.  
  2674.     fseek(scr_file, (long)cur_user.rank * sizeof(scr_rec), SEEK_SET);
  2675.     ny_fwrite(&rec[crnt1], sizeof(scr_rec), 1, scr_file);
  2676.  
  2677.     if (cnt>0) {
  2678.       ch_flag_d();
  2679.       do {
  2680.     sorted=TRUE;
  2681.  
  2682.     fseek(scr_file, (long)(cnt-1) * sizeof(scr_rec), SEEK_SET);
  2683.     ny_fread(&rec[crnt1], sizeof(scr_rec), 1, scr_file);
  2684.  
  2685.     fseek(scr_file, (long)cnt * sizeof(scr_rec), SEEK_SET);
  2686.     ny_fread(&rec[crnt2], sizeof(scr_rec), 1, scr_file);
  2687.  
  2688.     if (rec[crnt1].points<rec[crnt2].points) { // switch records
  2689.  
  2690.       sorted=FALSE; // run another round
  2691.  
  2692.       sprintf(numstr,"u%07d.on",rec[crnt1].user_num);
  2693.       if (single_node==FALSE && findfirst(numstr,&fff,0)==0) {
  2694.         sprintf(numstr,"u%07d.rnk",rec[crnt1].user_num);
  2695.         njustfile = ShareFileOpen(numstr, "wb");
  2696.         ny_fwrite(&cnt,2,1,njustfile);
  2697.         fclose(njustfile);
  2698.       } else {
  2699.         fseek(fpUserFile, (long)rec[crnt1].user_num * sizeof(user_rec), SEEK_SET);
  2700.         ny_fread(&urec,sizeof(user_rec),1,fpUserFile);
  2701.         urec.rank=cnt;
  2702.         fseek(fpUserFile, (long)rec[crnt1].user_num * sizeof(user_rec), SEEK_SET);
  2703.         ny_fwrite(&urec,sizeof(user_rec),1,fpUserFile);
  2704.       }
  2705.  
  2706.       if (usr==nCurrentUserNumber) {
  2707.         cur_user.rank=cnt-1;
  2708.       } else {
  2709.         sprintf(numstr,"u%07d.on",rec[crnt2].user_num);
  2710.         if (single_node==FALSE && findfirst(numstr,&fff,0)==0) {
  2711.           sprintf(numstr,"u%07d.rnk",rec[crnt2].user_num);
  2712.           njustfile = ShareFileOpen(numstr, "wb");
  2713.           cnt--;
  2714.           ny_fwrite(&cnt,2,1,njustfile);
  2715.           cnt++;
  2716.           fclose(njustfile);
  2717.         } else {
  2718.           fseek(fpUserFile, (long)rec[crnt2].user_num * sizeof(user_rec), SEEK_SET);
  2719.           ny_fread(&urec,sizeof(user_rec),1,fpUserFile);
  2720.           urec.rank=cnt-1;
  2721.           fseek(fpUserFile, (long)rec[crnt2].user_num * sizeof(user_rec), SEEK_SET);
  2722.           ny_fwrite(&urec,sizeof(user_rec),1,fpUserFile);
  2723.         }
  2724.       }
  2725.  
  2726.       fseek(scr_file, (long)(cnt-1) * sizeof(scr_rec), SEEK_SET);
  2727.       ny_fwrite(&rec[crnt2],sizeof(scr_rec),1,scr_file);
  2728.       fseek(scr_file, (long)cnt * sizeof(scr_rec), SEEK_SET);
  2729.       ny_fwrite(&rec[crnt1],sizeof(scr_rec),1,scr_file);
  2730.  
  2731.     }
  2732.     cnt--;
  2733.       } while (sorted==FALSE && cnt>0);
  2734.     }
  2735.  
  2736.     fclose(scr_file);
  2737.     fclose(fpUserFile);
  2738.   }
  2739. }
  2740.  
  2741.  
  2742.  
  2743. void
  2744. SortScrFileB(int usr) // pebble sorting of scorefile
  2745. {
  2746.   FILE *justfile;
  2747.   FILE *scr_file;
  2748.   FILE *fpUserFile;
  2749.   FILE *njustfile;
  2750.   int crnt1,crnt2,cnt,sorted,cont;
  2751.   scr_rec rec[2];
  2752.   user_rec urec;
  2753.   char numstr[20];
  2754. //  ffblk ffblk;
  2755.  
  2756.  // sort in a certain user either current or an offline user
  2757.     ch_game_d();
  2758.     scr_file=ShareFileOpenAR(SCR_FILENAME,"r+b");
  2759.     fpUserFile=ShareFileOpenAR(USER_FILENAME,"r+b");
  2760.     if (usr==nCurrentUserNumber) {
  2761.       cnt=cur_user.rank;
  2762.     } else {
  2763.       fseek(fpUserFile, (long)usr * sizeof(user_rec), SEEK_SET);
  2764.       ny_fread(&urec, sizeof(user_rec), 1, fpUserFile);
  2765.       cnt=urec.rank;
  2766.     }
  2767.     //od_printf("\n\r\n\r%d\n\r\n\r",cnt);
  2768.  
  2769.     crnt1=0;
  2770.     crnt2=1;
  2771.  
  2772.     strcpy(rec[crnt1].name,cur_user.name);
  2773.     rec[crnt1].nation=cur_user.nation;
  2774.     rec[crnt1].level=cur_user.level;
  2775.     rec[crnt1].points=cur_user.points;
  2776.     rec[crnt1].alive=cur_user.alive;
  2777.     rec[crnt1].sex=cur_user.sex;
  2778.     rec[crnt1].user_num=nCurrentUserNumber;
  2779.     rec[crnt1].online=TRUE;
  2780.  
  2781.  
  2782.     fseek(scr_file, (long)cur_user.rank * sizeof(scr_rec), SEEK_SET);
  2783.     ny_fwrite(&rec[crnt1], sizeof(scr_rec), 1, scr_file);
  2784.     cont=filelength(fileno(scr_file))/sizeof(scr_rec);
  2785.  
  2786.     if (cnt<(cont-1)) {
  2787.       ch_flag_d();
  2788.       do {
  2789.     sorted=TRUE;
  2790.  
  2791.     fseek(scr_file, (long)(cnt+1) * sizeof(scr_rec), SEEK_SET);
  2792.     ny_fread(&rec[crnt1], sizeof(scr_rec), 1, scr_file);
  2793.  
  2794.     fseek(scr_file, (long)cnt * sizeof(scr_rec), SEEK_SET);
  2795.     ny_fread(&rec[crnt2], sizeof(scr_rec), 1, scr_file);
  2796.     if (rec[crnt1].points>rec[crnt2].points) { // switch records
  2797.  
  2798.       sorted=FALSE; // run another round
  2799.  
  2800.       sprintf(numstr,"u%07d.on",rec[crnt1].user_num);
  2801.       if (single_node==FALSE && findfirst(numstr,&fff,0)==0) {
  2802.         sprintf(numstr,"u%07d.rnk",rec[crnt1].user_num);
  2803.         njustfile = ShareFileOpen(numstr, "wb");
  2804.         ny_fwrite(&cnt,2,1,njustfile);
  2805.         fclose(njustfile);
  2806.       } else {
  2807.         fseek(fpUserFile, (long)rec[crnt1].user_num * sizeof(user_rec), SEEK_SET);
  2808.         ny_fread(&urec,sizeof(user_rec),1,fpUserFile);
  2809.         urec.rank=cnt;
  2810.         fseek(fpUserFile, (long)rec[crnt1].user_num * sizeof(user_rec), SEEK_SET);
  2811.         ny_fwrite(&urec,sizeof(user_rec),1,fpUserFile);
  2812.       }
  2813.  
  2814.       if (usr==nCurrentUserNumber) {
  2815.         cur_user.rank=cnt+1;
  2816.       } else {
  2817.         sprintf(numstr,"u%07d.on",rec[crnt2].user_num);
  2818.         if (single_node==FALSE && findfirst(numstr,&fff,0)==0) {
  2819.           sprintf(numstr,"u%07d.rnk",rec[crnt2].user_num);
  2820.           njustfile = ShareFileOpen(numstr, "wb");
  2821.           cnt++;
  2822.           ny_fwrite(&cnt,2,1,njustfile);
  2823.           cnt--;
  2824.           fclose(njustfile);
  2825.         } else {
  2826.           fseek(fpUserFile, (long)rec[crnt2].user_num * sizeof(user_rec), SEEK_SET);
  2827.           ny_fread(&urec,sizeof(user_rec),1,fpUserFile);
  2828.           urec.rank=cnt+1;
  2829.           fseek(fpUserFile, (long)rec[crnt2].user_num * sizeof(user_rec), SEEK_SET);
  2830.           ny_fwrite(&urec,sizeof(user_rec),1,fpUserFile);
  2831.         }
  2832.       }
  2833.  
  2834.       fseek(scr_file, (long)(cnt+1) * sizeof(scr_rec), SEEK_SET);
  2835.       ny_fwrite(&rec[crnt2],sizeof(scr_rec),1,scr_file);
  2836.       fseek(scr_file, (long)cnt * sizeof(scr_rec), SEEK_SET);
  2837.       ny_fwrite(&rec[crnt1],sizeof(scr_rec),1,scr_file);
  2838.  
  2839.     }
  2840.     cnt++;
  2841.       } while (sorted==FALSE && cnt<(cont-1));
  2842.     }
  2843.     fclose(scr_file);
  2844.     fclose(fpUserFile);
  2845.  
  2846. }
  2847.  
  2848.  
  2849.  
  2850. void
  2851. change_info(void)
  2852. {
  2853.   char key;
  2854.   char numstr[25],numstr2[25],numstr3[25];
  2855.  
  2856.  
  2857.   do {
  2858.     od_printf("\n\r\n\r");
  2859.     ny_clr_scr();
  2860.  
  2861.     ny_line(28,0,2);
  2862. //    ny_disp_emu("`@C`4hange `@Y`4er `@I`4nfo\n\r\n\r");
  2863.     ny_line(29,0,0);
  2864. //    ny_disp_emu("`%1 `4- `@Y`4er name: `0");
  2865.     ny_disp_emu(cur_user.name);
  2866.     ny_line(30,1,0);
  2867. //    ny_disp_emu("\n\r`%2 `4- `@W`4hen you win ya say: `0");
  2868.     ny_disp_emu(cur_user.say_win);
  2869.     ny_line(31,1,0);
  2870. //    ny_disp_emu("\n\r`%3 `4- `@W`4hen you loose ya say: `0");
  2871.     ny_disp_emu(cur_user.say_loose);
  2872.     ny_line(32,1,1);
  2873. //    ny_disp_emu("\n\r`%Q `4- `@R`4eturn to Central Park\n\r");
  2874.  
  2875.     ny_line(33,1,0);
  2876. //    ny_disp_emu("\n\r`9W`1hich ya wanna change? (`91`1,`92`1,`93`1,`9Q`1`)");
  2877.  
  2878.     key=ny_get_answer("123Q");
  2879.  
  2880.     od_printf("%c\n\r\n\r",key);
  2881.     if (key=='1') {
  2882.       do {
  2883.  
  2884.     od_printf("\n\r");
  2885.     if(rip) od_send_file("texti.rip");
  2886.     ny_send_menu(NEW_NAME,"");
  2887. //      ny_disp_emu("\n\r`@I`4nput yer new name: (`@ENTER`4=abort\n\r|------------------------|\n\r`0");
  2888.  
  2889.     od_input_str(numstr,24,' ',255);
  2890.       } while (numstr[0]!=0 && stricmp(ny_un_emu(numstr,numstr2),ny_un_emu(cur_user.name,numstr3))!=0 && CheckForHandle(numstr)!=FALSE);
  2891.       trim(numstr);
  2892.       if (numstr[0]!=0) {
  2893.     strcpy(cur_user.name,numstr);
  2894.     wrt_sts();
  2895.     sprintf(od_control.user_name,"%s (%s)",ny_un_emu(cur_user.name,numstr),uname);
  2896.     ibbs_act_rec act_rec;
  2897.     act_rec.action=0;
  2898.     strcpy(act_rec.name_sI,cur_user.bbsname);
  2899.     strcpy(act_rec.name_s,cur_user.name);
  2900.     if(ibbs) IBSendAll(&IBBSInfo,(char *)&act_rec,sizeof(ibbs_act_rec));
  2901.     od_control.od_update_status_now=TRUE;
  2902.       }
  2903.     } if (key=='2') {
  2904.  
  2905.       od_printf("\n\r");
  2906.       if(rip) od_send_file("texti.rip");
  2907.       ny_send_menu(NEW_WIN,"");
  2908. //      ny_disp_emu("\n\r`@W`4hat do you say when you win:\n\r|--------------------------------------|\n\r`0");
  2909.  
  2910.       od_input_str(cur_user.say_win,40,' ',255);
  2911.       wrt_sts();
  2912.     } else if (key=='3') {
  2913.  
  2914.       od_printf("\n\r");
  2915.       if(rip) od_send_file("texti.rip");
  2916.       ny_send_menu(NEW_LOOSE,"");
  2917.  
  2918. //      od_printf("\n\r\n\r`@W`4hat do you say when you get yer ass kicked:\n\r|--------------------------------------|`0\n\r");
  2919.  
  2920.       od_input_str(cur_user.say_loose,40,' ',255);
  2921.       wrt_sts();
  2922.     }
  2923.   } while (key!='Q');
  2924. }
  2925.  
  2926.  
  2927.  
  2928. char entry_menu(void)
  2929.    {
  2930.    char key;
  2931.    char allowed[]="ELYNQ\n\r";
  2932.    FILE *justfile;
  2933.    int intval;
  2934.    static int unreg_sign=TRUE;
  2935.    char numstr[100];
  2936.  
  2937.  
  2938.    key=0;
  2939.  
  2940.  
  2941.  
  2942.    od_clear_keybuffer();               // Clear any pending keys in buffer
  2943.    od_printf("\n\r\n\r");
  2944.    ny_clr_scr();                       // Clear screen
  2945.  
  2946.    ny_send_menu(ENTRY_1,"");
  2947.  
  2948. /*   ny_disp_emu("\n\r`@N`4ew `@Y`4ork `@2008\n\r\n\r");
  2949. //   ny_kernel();
  2950.    ny_disp_emu("`2By `0Franz\n\r\n\r");//`bright green`Doom`green` helped\n\r\n\r");
  2951. //   ny_kernel();
  2952.    ny_disp_emu("`4Version `@0.01 `%BETA 9\n\r");
  2953. //   ny_kernel();
  2954.    ny_disp_emu("`1Copyright 1995, George Lebl\n\r");*/
  2955.  
  2956.   if(!rip) {
  2957.    //od_printf("`blue`Thx fer the help Martin ...\n\r");
  2958.    if(clean_mode==TRUE)
  2959.      ny_disp_emu("`@C`4lean mode `@ON\n\r");
  2960. //   else if(clean_mode==666)
  2961. //     ny_disp_emu("`@X`4tra Fucking Dirty mode `@ON\n\r");
  2962.    if (registered==TRUE) {
  2963.      ny_disp_emu("`@REGISTERED `4to ");
  2964.      ny_disp_emu(od_control.system_name);
  2965.      if(rec_credit[0]!=0) {
  2966.        ny_disp_emu("`@!\n\r");
  2967.        ny_line(405,0,0);//`@T`4hanks to `0");
  2968.        ny_disp_emu(rec_credit);
  2969.      }
  2970.      ny_disp_emu("`@!\n\r");
  2971.    } else {
  2972.      if(unreg_sign==TRUE) {
  2973.        ny_disp_emu("`%UNREGISTERED!\n\rPausing For 5 Seconds `#.");
  2974.        unreg_sign=FALSE;
  2975.        sleep(1);
  2976.        ny_kernel();
  2977.        od_printf(".");
  2978.        sleep(1);
  2979.        ny_kernel();
  2980.        od_printf(".");
  2981.        sleep(1);
  2982.        ny_kernel();
  2983.        od_printf(".");
  2984.        sleep(1);
  2985.        ny_kernel();
  2986.        od_printf(".");
  2987.        ny_kernel();
  2988.        sleep(1);
  2989.        od_printf("\r");
  2990.      } else {
  2991.        ny_disp_emu("`%UNREGISTERED!\n\r");
  2992.        ny_line(404,0,1);
  2993.      }
  2994.    }
  2995.    ny_kernel();
  2996.    ch_game_d();
  2997.    justfile=ShareFileOpen("NYGAME.DAY","rb");
  2998.    ny_fread(&intval,2,1,justfile);
  2999.    fclose(justfile);
  3000.    ny_line(34,0,0);
  3001. //   ny_disp_emu("`$T`6his game has been running for `0");
  3002.    od_printf("%d",intval);
  3003.    ny_line(35,0,1);
  3004. //   ny_disp_emu("`6 days!\n\r");
  3005.  
  3006.    key=ny_send_menu(ENTRY_2,allowed);
  3007.   }
  3008.  
  3009.   if(!rip) {
  3010.     ny_line(36,0,0);
  3011.     //Enter Yer Command (
  3012.     od_printf("%d ",od_control.caller_timelimit);
  3013.     ny_line(37,0,0);
  3014.   }
  3015. //   ny_disp_emu("`1mins)`9>");
  3016. //   entry_after:;
  3017.  
  3018.  
  3019.    if(key==0) {
  3020.      if(rip) od_disp_str("\n\r!|10$HKEYON$|#|#|#\n\r");
  3021.      key= ny_get_answer(allowed);
  3022.      if(rip) od_disp_str("\n\r!|10$HKEYOFF$|#|#|#\n\r");
  3023.    }
  3024.    if(!rip)
  3025.      od_printf("%c\n\r",key);
  3026.    else
  3027.      od_disp_str("\n\r");
  3028.  
  3029.    return key;
  3030.    }
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042. /*user stats display*/
  3043. void
  3044. DisplayStats(void)
  3045. {
  3046.   int intval;
  3047.  
  3048.   ny_kernel();
  3049.   wrt_sts(); //just in case write the stats file
  3050.  
  3051.   if(oneframe==FALSE || rip==FALSE) {
  3052.     od_printf("\n\r\n\r");
  3053.     ny_clr_scr();
  3054.     if(rip) od_send_file("FRAME1.RIP");
  3055.   } else {
  3056.     od_disp_str("\n\r!|e|#|#|#\n\r  \b\b");
  3057.   }
  3058.   //ny_line(38,0,0);
  3059.   ny_stat_line(0,0,0);
  3060. //  ny_disp_emu("`%S`!t`9ats `%F`!o`9r `%L`!e`9vel `%");
  3061.   od_printf("%d ",(int)cur_user.level);
  3062.   switch (cur_user.nation) {
  3063.     case HEADBANGER: ny_stat_line(1,0,0); break;
  3064.     case HIPPIE: ny_stat_line(2,0,0); break;
  3065.     case BIG_FAT_DUDE: ny_stat_line(3,0,0); break;
  3066.     case CRACK_ADDICT: ny_stat_line(4,0,0); break;
  3067.     case PUNK: ny_stat_line(5,0,0); break;
  3068.   }
  3069.   ny_disp_emu(" `@");
  3070.   ny_disp_emu(cur_user.name);
  3071. //  od_printf("\n\r");
  3072. //  ny_send_menu(BLUE_LINE,"");
  3073. //  ny_line(399,1,1);
  3074.   ny_stat_line(6,1,1);
  3075.  // ny_disp_emu("\n\r`1-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  3076.   //ny_line(39,0,0);
  3077.   ny_stat_line(7,0,0);
  3078. //  ny_disp_emu("`@S`4ex: `0");
  3079.   if (cur_user.sex==MALE)
  3080.     ny_stat_line(8,0,0);
  3081.   else
  3082.     ny_stat_line(9,0,0);
  3083.  
  3084.   od_repeat(' ',29);
  3085.   //ny_line(270,0,0);
  3086.   ny_stat_line(10,0,0);
  3087.   //ny_disp_emu("`@S`4tatus: `@");
  3088.   if (cur_user.alive==ALIVE)
  3089.     //ny_line(369,0,1);
  3090.     ny_stat_line(11,0,1);
  3091.     //ny_disp_emu("`0A`2live\n\r");
  3092.   else if (cur_user.alive==DEAD)
  3093.     //ny_line(370,0,1);
  3094.     ny_stat_line(12,0,1);
  3095.     //ny_disp_emu("DEAD\n\r");
  3096.   else
  3097.     //ny_line(371,0,1);
  3098.     ny_stat_line(13,0,1);
  3099.     //ny_disp_emu("UNCONSIOUS\n\r");
  3100.   //ny_line(271,0,0);
  3101.   ny_stat_line(14,0,0);
  3102. //  od_printf("`bright red`P`red`oints: `bright green`
  3103.   od_printf("%-16s",D_Num(cur_user.points));
  3104.   od_repeat(' ',16);
  3105.   //ny_line(272,0,0);
  3106.   ny_stat_line(15,0,0);
  3107. //  od_printf("`bright red`M`red`oney `bright red`I`red`n `bright red`H`red`and: `bright green`
  3108.   od_printf("%s\n\r",D_Num(cur_user.money));
  3109.   //ny_line(273,0,0);
  3110.   ny_stat_line(16,0,0);
  3111. //  od_printf("`bright red`F`red`ights: `bright green`
  3112.   od_printf("%-3d", (int)cur_user.turns);
  3113.   od_repeat(' ',29);
  3114.   //ny_line(274,0,0);
  3115.   ny_stat_line(17,0,0);
  3116. //  od_printf("`bright red`M`red`oney `bright red`I`red`n `bright red`B`red`ank: `bright green`
  3117.   od_printf("%s\n\r",D_Num(cur_user.bank));
  3118.   //ny_line(275,0,0);
  3119.   ny_stat_line(18,0,0);
  3120. //  od_printf("`bright red`H`red`it `bright red`P`red`oints: `bright green`
  3121.   od_printf("%s ",D_Num(cur_user.hitpoints));
  3122.   intval=strlen(str);
  3123.   //ny_line(276,0,0);
  3124.   ny_stat_line(19,0,0);
  3125. //  od_printf("`bright red`o`red`f `bright green`
  3126.   od_printf("%-9s", D_Num(cur_user.maxhitpoints));
  3127.   od_repeat(' ',40-intval-25);
  3128.   //ny_line(277,0,0);
  3129.   ny_stat_line(20,0,0);
  3130. //  od_printf("`bright red`H`red`ungry: `bright green`
  3131.   od_printf("%d%c\n\r", (int)cur_user.hunger,37);
  3132.   //ny_line(278,0,0);
  3133.   ny_stat_line(21,0,0);
  3134. //  ny_disp_emu("`@A`4rm: ");
  3135.   print_arm(cur_user.arm);
  3136.   //ny_line(279,1,0);
  3137.   ny_stat_line(22,1,0);
  3138. //  ny_disp_emu("\n\r`@W`4inning `@S`4entence: `0");
  3139.   ny_disp_emu(cur_user.say_win);
  3140.   //ny_line(280,1,0);
  3141.   ny_stat_line(23,1,0);
  3142. //  ny_disp_emu("\n\r`@L`4oosing `@S`4entence: `0");
  3143.   ny_disp_emu(cur_user.say_loose);
  3144.   //ny_line(281,1,0);
  3145.   ny_stat_line(24,1,0);
  3146. //  od_printf("\n\r`bright red`D`red`ays `bright red`S`red`ince `bright red`G`red`ot `bright red`L`red`aid: `bright green`
  3147.   od_printf("%-4d", (int)cur_user.since_got_laid);
  3148.   od_repeat(' ',15);
  3149.   //ny_line(282,0,0);
  3150.   ny_stat_line(25,0,0);
  3151. //  ny_disp_emu("`@S`4TD: `0");
  3152.   print_disease(cur_user.std);
  3153.   //ny_line(283,1,0);
  3154.   ny_stat_line(26,1,0);
  3155. //  od_printf("\n\r`bright red`S`red`ex `bright red`T`red`urns `bright red`L`red`eft: `bright green`
  3156.   od_printf("%-4d", (int)cur_user.sex_today);
  3157.   od_repeat(' ',20);
  3158.   //ny_line(284,0,0);
  3159.   ny_stat_line(27,0,0);
  3160. //  od_printf("`bright red`I`red`nfected: `bright green`
  3161.   od_printf("%d%c\n\r", (int)cur_user.std_percent,37);
  3162.   //ny_line(285,0,0);
  3163.   ny_stat_line(28,0,0);
  3164. //  od_printf("`bright red`C`red`ondoms: `bright green`
  3165.   od_printf("%d\n\r", (int)cur_user.condoms);
  3166.   //ny_line(433,0,0);
  3167.   ny_stat_line(29,0,0);
  3168.   od_printf("%d\n\r", (int)cur_user.rocks);
  3169.   //ny_line(434,0,0);
  3170.   ny_stat_line(30,0,0);
  3171.   od_printf("%d ", (int)cur_user.throwing_ability);
  3172.   //ny_line(435,0,0);
  3173.   ny_stat_line(31,0,0);
  3174.   od_printf("%d ", (int)cur_user.kick_ability);
  3175.   //ny_line(436,0,0);
  3176.   ny_stat_line(32,0,0);
  3177.   od_printf("%d\n\r", (int)cur_user.punch_ability);
  3178.   //ny_line(286,0,0);
  3179.   ny_stat_line(33,0,0);
  3180. //  ny_disp_emu("`@D`4rug: `0");
  3181.   print_drug(cur_user.drug);
  3182.   //ny_line(287,1,0);
  3183.   ny_stat_line(34,1,0);
  3184. //  od_printf("\n\r`bright red`H`red`its: `bright green`
  3185.   od_printf("%-6d\n\r",(int)cur_user.drug_hits);
  3186.   //ny_line(288,0,0);
  3187.   ny_stat_line(35,0,0);
  3188. //  od_printf("`bright red`H`red`igh: `bright green`
  3189.   od_printf("%d%c\n\r",(int)cur_user.drug_high,37);
  3190.   if (cur_user.drug>=COKE) {
  3191.     //ny_line(289,0,0);
  3192.     ny_stat_line(36,0,0);
  3193. //    od_printf("`bright red`A`red`ddicted: `bright green`
  3194.     od_printf("%d%c\n\r", (int)cur_user.drug_addiction,37);
  3195.     if (cur_user.drug_addiction>0) {
  3196.       //ny_line(290,0,0);
  3197.       ny_stat_line(37,0,0);
  3198.       //od_printf("`bright red`D`red`ays `bright red`S`red`ince `bright red`L`red`ast `bright red`H`red`it: `bright green`
  3199.       od_printf("%d\n\r",(int)cur_user.drug_days_since);
  3200.     }
  3201.   }
  3202.   if(cur_user.rest_where!=NOWHERE) {
  3203.     //ny_line(291,0,0);
  3204.     ny_stat_line(38,0,0);
  3205.   //  ny_disp_emu("`@S`4taying `@a`4t: `0");
  3206.     if (cur_user.rest_where==MOTEL)ny_stat_line(39,0,0);// ny_line(372,0,0); //ny_disp_emu("C`2heap `0M`2otel");
  3207.     else if (cur_user.rest_where==REG_HOTEL) ny_stat_line(40,0,0); //ny_line(373,0,0);//ny_disp_emu("R`2egular `0H`2otel");
  3208.     else if (cur_user.rest_where==EXP_HOTEL) ny_stat_line(41,0,0);//ny_line(374,0,0);//ny_disp_emu("E`2xpensive `0H`2otel");
  3209.     //ny_line(292,0,0);
  3210.     ny_stat_line(42,0,0);
  3211. //    ny_disp_emu(" `@F`4or `0");
  3212.     od_printf("%d",(int)cur_user.hotel_paid_fer);
  3213.     //ny_line(293,0,1);
  3214.     ny_stat_line(43,0,1);
  3215. //    ny_disp_emu("`@ D`4ays\n\r");
  3216.   }
  3217. //  ny_send_menu(BLUE_LINE,"");
  3218.   //ny_line(399,0,1);
  3219.   ny_stat_line(6,0,1);
  3220. //  ny_disp_emu("`1-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
  3221.  
  3222. //  WaitForEnter();
  3223. }
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230. void   //die of 1=drugs 2=hunger 3=std 4=suicide
  3231. Die(int diecode)
  3232. {
  3233.   cur_user.alive=DEAD;
  3234.   wrt_sts();
  3235.  
  3236.   od_printf("\n\r\n\r");
  3237.   ny_clr_scr();
  3238.   ny_line(40,0,2);
  3239. //  ny_disp_emu("\n\r\n\r`@W`4ell it's end of the road for ya....yer `%DEAD`4!");
  3240.   ny_line(41,0,0);
  3241. //  ny_disp_emu("\n\r\n\r`0Y`2ou died of: `0");
  3242.   switch (diecode) {
  3243.     case 1:
  3244.       ny_line(42,0,2);
  3245.       ny_line(43,0,0);
  3246.   //    ny_disp_emu("Drug Overdose\n\r\n\r`@Y`4a should consider cutting down on those drugs next time...");
  3247.       news_post("died of drug overdose",cur_user.name,"",3);
  3248.       break;
  3249.     case 2:
  3250.       ny_line(44,0,2);
  3251.       ny_line(45,0,0);
  3252. //    ny_disp_emu("Hunger\n\r\n\r`@Y`4a should consider eating more next time...");
  3253.       news_post("died of hunger",cur_user.name,"",3);
  3254.       break;
  3255.     case 3:
  3256.       ny_line(46,0,2);
  3257.       if(cur_user.sex==MALE)
  3258.     ny_line(47,0,0);
  3259.       else
  3260.     ny_line(48,0,0);
  3261.  
  3262.       news_post("died of sexual desease",cur_user.name,"",3);
  3263.       break;
  3264.  
  3265.     case 4:
  3266.       ny_line(49,0,2);
  3267.       ny_line(50,0,0);
  3268.   //    ny_disp_emu("Suicide\n\r\n\r`@Y`4a should talk to somebody before you get that down ...next time...");
  3269.       news_post("comitted suicide",cur_user.name,"",3);
  3270.       break;
  3271.   }
  3272.  
  3273.   ny_line(51,2,1);
  3274. //  od_printf("\n\r\n\r`bright`But you can still start all over tomorrow and be the best!\n\r");
  3275.   WaitForEnter();
  3276.   od_exit(10,FALSE);
  3277. }
  3278.  
  3279.  
  3280.  
  3281. void
  3282. print_drug(drug_type drug)
  3283. {
  3284.   switch(drug) {
  3285.     case POT: ny_line(375,0,0); break;     // Pot
  3286.     case HASH: ny_line(376,0,0); break;    // Hash
  3287.     case LSD: ny_line(377,0,0); break;     // LSD
  3288.     case COKE: ny_line(378,0,0); break;    // Coke
  3289.     case PCP: ny_line(379,0,0); break;     // PCP
  3290.     case HEROIN: ny_line(380,0,0); break;  // Heroin
  3291.   }
  3292. }
  3293.  
  3294.  
  3295. void
  3296. print_disease(desease ill)
  3297. {
  3298.   switch (ill) {
  3299.     case NONE: ny_line(381,0,0); break;              // Healthy
  3300.     case CRAPS: ny_line(382,0,0); break;             // Crabs
  3301.     case HERPES: ny_line(383,0,0); break;            // Herpes
  3302.     case SYPHILIS: ny_line(384,0,0); break;          // Syphilis
  3303.     case AIDS: ny_line(385,0,0); break;              // AIDS
  3304.   }
  3305. }
  3306.  
  3307.  
  3308.  
  3309.  
  3310. void
  3311. print_arm(weapon arm)
  3312. {
  3313.   switch (arm) {
  3314.     case HANDS: ny_line(386,0,0); break;
  3315.     case PEPPER: ny_line(387,0,0); break;
  3316.     case SHARP_STICK: ny_line(471,0,0); break;
  3317.     case SCREWDRIVER: ny_line(472,0,0); break;
  3318.     case KNIFE: ny_line(388,0,0); break;
  3319.     case HAMMER: ny_line(473,0,0); break;
  3320.     case CHAIN: ny_line(389,0,0); break;
  3321.     case LEAD_PIPE: ny_line(474,0,0); break;
  3322.     case GUN: ny_line(390,0,0); break;
  3323.     case COLT: ny_line(475,0,0); break;
  3324.     case RIFLE: ny_line(391,0,0); break;
  3325.     case ELEPHANT_GUN: ny_line(476,0,0); break;
  3326.     case LASER_GUN: ny_line(392,0,0); break;
  3327.     case NAILGUN: ny_line(477,0,0); break;
  3328.     case SHOTGUN: ny_line(393,0,0); break;
  3329.     case ASSAULT_RIFLE: ny_line(478,0,0); break;
  3330.     case MACHINEGUN: ny_line(394,0,0); break;
  3331.     case PROTON_GUN: ny_line(479,0,0); break;
  3332.     case GRANADE_LAUNCHER: ny_line(395,0,0); break;
  3333.     case NEUTRON_PHASER: ny_line(480,0,0); break;
  3334.     case BLASTER: ny_line(396,0,0); break;
  3335.     case ULTRASOUND_GUN: ny_line(481,0,0); break;
  3336.     case A_BOMB: ny_line(397,0,0); break;
  3337.   }
  3338. }
  3339.  
  3340. /*current player listing*/
  3341. void
  3342. MakeFiles(void)
  3343.     {
  3344.     FILE *scr_file;
  3345.     FILE *ascii_file;
  3346.     FILE *ansi_file;
  3347.     scr_rec user_scr;
  3348.     long filepos;
  3349.     int cnt;
  3350.  
  3351.     //od_printf("\n\r\n\r");
  3352.     //ny_clr_scr();
  3353.     ch_game_d();
  3354.     ansi_file=ShareFileOpen(ansi_name,"w");
  3355.     ascii_file=ShareFileOpen(ascii_name,"w");
  3356.     fprintf(ansi_file,"Player Listing For New York 2008\n\n");
  3357.     fprintf(ascii_file,"Player Listing For New York 2008\n\n");
  3358.     fprintf(ansi_file,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  3359.     fprintf(ascii_file,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  3360.     if ((scr_file=ShareFileOpen(SCR_FILENAME,"rb"))!=NULL) {
  3361.       cnt=1;
  3362.       fprintf(ansi_file,"Rank: Lvl: Name:                     Points:              S: T:\n");
  3363.       fprintf(ascii_file,"Rank: Lvl: Name:                     Points:              S: T:\n");
  3364.       while (ny_fread(&user_scr, sizeof(scr_rec), 1, scr_file) == 1) {
  3365.         fprintf(ansi_file,"%-5d %-2d   ",cnt,user_scr.level);
  3366.         fprintf(ascii_file,"%-5d %-2d   ",cnt,user_scr.level);
  3367.         ny_disp_emu_file(ansi_file,ascii_file,user_scr.name,25);
  3368.         fprintf(ansi_file," %-20s ",D_Num(user_scr.points));
  3369.         fprintf(ascii_file," %-20s ",D_Num(user_scr.points));
  3370.         if (user_scr.sex==MALE) {
  3371.           fprintf(ansi_file,"M  ");
  3372.           fprintf(ascii_file,"M  ");
  3373.         } else {
  3374.           fprintf(ansi_file,"F  ");
  3375.           fprintf(ascii_file,"F  ");
  3376.         }
  3377.  
  3378.         switch(user_scr.nation) {
  3379.           case HEADBANGER:
  3380.         fprintf(ansi_file,"HEADBANGER    ");
  3381.         fprintf(ascii_file,"HEADBANGER   ");
  3382.         break;
  3383.           case HIPPIE:
  3384.         fprintf(ansi_file,"HIPPIE       ");
  3385.         fprintf(ascii_file,"HIPPIE       ");
  3386.         break;
  3387.           case BIG_FAT_DUDE:
  3388.         fprintf(ansi_file,"BIG FAT DUDE ");
  3389.         fprintf(ascii_file,"BIG FAT DUDE ");
  3390.         break;
  3391.           case CRACK_ADDICT:
  3392.         fprintf(ansi_file,"CRACK ADDICT ");
  3393.         fprintf(ascii_file,"CRACK ADDICT ");
  3394.         break;
  3395.           case PUNK:
  3396.         fprintf(ansi_file,"PUNK         ");
  3397.         fprintf(ascii_file,"PUNK         ");
  3398.         break;
  3399.         }
  3400.  
  3401.         fprintf(ansi_file,"\n");
  3402.         fprintf(ascii_file,"\n");
  3403.         cnt++;
  3404.       }
  3405.       fclose(scr_file);
  3406.       fclose(ansi_file);
  3407.       fclose(ascii_file);
  3408.  
  3409.     }
  3410. }
  3411.  
  3412.  
  3413. void
  3414. PlInfo(scr_rec *user_scr, int cnt)
  3415. {
  3416.         od_printf("`bright blue`%-5d `bright green`%-2d   `bright red`",cnt,user_scr->level);
  3417.         ny_disp_emu(user_scr->name,25);
  3418.         od_set_attrib(0x0a);
  3419.         od_printf(" %-20s ",D_Num(user_scr->points));
  3420.         if (user_scr->sex==MALE) ny_disp_emu("`$M  "); else ny_disp_emu("`$F  ");
  3421.         od_set_attrib(0x09);
  3422.         switch (user_scr->nation) {
  3423.           case HEADBANGER:   od_disp_str("HEADBANGER   "); break;
  3424.           case HIPPIE:       od_disp_str("HIPPIE       "); break;
  3425.           case BIG_FAT_DUDE: od_disp_str("BIG FAT DUDE "); break;
  3426.           case CRACK_ADDICT: od_disp_str("CRACK ADDICT "); break;
  3427.           case PUNK:         od_disp_str("PUNK         "); break;
  3428.         }
  3429.         if (user_scr->online==TRUE) ny_disp_emu("`%ON");
  3430.         od_disp_str("\n\r");
  3431. }
  3432.  
  3433.  
  3434.  
  3435. /*current player listing*/
  3436. void
  3437. ListPlayers(void)
  3438.     {
  3439.     FILE *scr_file;
  3440.     scr_rec user_scr;
  3441.     long filepos;
  3442.     int cnt,cnt2;
  3443.     char key;
  3444.     int nonstop=FALSE;
  3445.  
  3446.     od_printf("\n\r\n\r");
  3447.     ny_clr_scr();
  3448.  
  3449.  
  3450.     if(rip) {
  3451.       od_send_file("FRAME.RIP");
  3452.       od_send_file("FRAME3.RIP");
  3453.     }
  3454.  
  3455.  
  3456.     cnt=1;
  3457.     cnt2=5;
  3458.     ny_send_menu(LIST,"");
  3459. /*      od_printf("`bright green`P`green`layer `bright green`L`green`isting `bright green`F`green`or `bright red`N`red`ew `bright red`Y`red`ork `bright red`2008\n\r\n\r");
  3460.     od_printf("`green`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  3461.     od_printf("`cyan`Rank: Lvl: Name:                     Points:              S: T:\n\r");*/
  3462.     ch_game_d();
  3463.     if ((scr_file=ShareFileOpen(SCR_FILENAME,"rb"))!=NULL) {
  3464.       //cnt=1;
  3465.       while (ny_fread(&user_scr, sizeof(scr_rec), 1, scr_file) == 1) {
  3466.         PlInfo(&user_scr,cnt);
  3467.  
  3468.         cnt++;
  3469.         cnt2++;
  3470.         if (nonstop==FALSE && cnt2%od_control.user_screen_length==0) {
  3471.           filepos=ftell(scr_file);
  3472.           fclose(scr_file);
  3473.  
  3474.           ny_disp_emu("`%More (Y/n/=)");
  3475.           key=ny_get_answer("YN=\n\r");
  3476.           od_disp_str("\r            \r");
  3477.           //if(key=='\n' || key=='\r') key='Y';
  3478.           //od_putch(key);
  3479.           cnt2=1;
  3480.           if(key=='N')
  3481.         return;
  3482.           else if(key=='=')
  3483.         nonstop=TRUE;
  3484.  
  3485.  
  3486.           //od_printf("\n\r");
  3487.           scr_file=ShareFileOpen(SCR_FILENAME,"rb");
  3488.           fseek(scr_file,filepos,SEEK_SET);
  3489.         }
  3490.       }
  3491.       fclose(scr_file);
  3492.  
  3493.       if(rip) od_send_file("FRAME1.RIP");
  3494.       WaitForEnter();
  3495.     }
  3496. }
  3497.  
  3498.  
  3499. /*current player listing of a certain sex*/
  3500. void
  3501. ListPlayersS(sex_type psex)
  3502.     {
  3503.     FILE *scr_file;
  3504.     scr_rec user_scr;
  3505.     long filepos;
  3506.     int cnt,rnk;
  3507.     int nonstop=FALSE;
  3508.     char key;
  3509.  
  3510.     od_printf("\n\r\n\r");
  3511.     ny_clr_scr();
  3512.  
  3513.     if(rip) {
  3514.       od_send_file("FRAME.RIP");
  3515.       od_send_file("FRAME3.RIP");
  3516.     }
  3517.     ny_send_menu(LIST,"");
  3518. /*      od_printf("`bright green`P`green`layer `bright green`L`green`isting `bright green`F`green`or `bright red`N`red`ew `bright red`Y`red`ork `bright red`2008\n\r\n\r");
  3519.     od_printf("`green`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  3520.     od_printf("`cyan`Rank: Lvl: Name:                     Points:              S: T:\n\r");*/
  3521.     ch_game_d();
  3522.     if ((scr_file=ShareFileOpen(SCR_FILENAME,"rb"))!=NULL) {
  3523.       cnt=5;
  3524.       rnk=1;
  3525.  
  3526.       while (ny_fread(&user_scr, sizeof(scr_rec), 1, scr_file) == 1) {
  3527.         if (user_scr.sex==psex) {
  3528.           PlInfo(&user_scr,cnt);
  3529.  
  3530.           cnt++;
  3531.           if (nonstop==FALSE && cnt%od_control.user_screen_length==0) {
  3532.         filepos=ftell(scr_file);
  3533.         fclose(scr_file);
  3534.  
  3535.  
  3536.         ny_disp_emu("`%More (Y/n/=)");
  3537.         key=ny_get_answer("YN=\n\r");
  3538.         od_disp_str("\r            \r");
  3539.         //if(key=='\n' || key=='\r') key='Y';
  3540.         //od_putch(key);
  3541.         cnt=1;
  3542.         if(key=='N')
  3543.           return;
  3544.         else if(key=='=')
  3545.           nonstop=TRUE;
  3546.  
  3547. //              WaitForEnter();
  3548.  
  3549.         //od_printf("\n\r");
  3550.         scr_file=ShareFileOpen(SCR_FILENAME,"rb");
  3551.         fseek(scr_file,filepos,SEEK_SET);
  3552.           }
  3553.         }
  3554.         rnk++;
  3555.       }
  3556.       fclose(scr_file);
  3557.  
  3558.       if(rip) od_send_file("FRAME1.RIP");
  3559.       WaitForEnter();
  3560.     }
  3561. }
  3562.  
  3563.  
  3564.  
  3565.  
  3566. /*current alive player listing*/
  3567. void
  3568. ListPlayersA()
  3569.     {
  3570.     FILE *scr_file;
  3571.     scr_rec user_scr;
  3572.     long filepos;
  3573.     int cnt,rnk;
  3574.     int nonstop=FALSE;
  3575.     char key;
  3576.  
  3577.  
  3578.     od_printf("\n\r\n\r");
  3579.     ny_clr_scr();
  3580.     if(rip) od_send_file("FRAME.RIP");
  3581.     if(rip) od_send_file("FRAME3.RIP");
  3582.     ny_send_menu(CONSIOUS,"");
  3583. /*      od_printf("`bright green`C`green`onsious `bright green`P`green`layer `bright green`L`green`isting `bright green`F`green`or `bright red`N`red`ew `bright red`Y`red`ork `bright red`2008\n\r\n\r");
  3584.     od_printf("`green`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  3585.     od_printf("`cyan`Rank: Lvl: Name:                     Points:              S: T:\n\r");*/
  3586.     ch_game_d();
  3587.     if ((scr_file=ShareFileOpen(SCR_FILENAME,"rb"))!=NULL) {
  3588.       cnt=5;
  3589.       rnk=1;
  3590.       while (ny_fread(&user_scr, sizeof(scr_rec), 1, scr_file) == 1) {
  3591.         if (user_scr.alive==ALIVE) {
  3592.  
  3593.           PlInfo(&user_scr,cnt);
  3594.  
  3595.  
  3596.           cnt++;
  3597.           if (nonstop==FALSE && cnt%od_control.user_screen_length==0) {
  3598.         filepos=ftell(scr_file);
  3599.         fclose(scr_file);
  3600.  
  3601.         ny_disp_emu("`%More (Y/n/=)");
  3602.         key=ny_get_answer("YN=\n\r");
  3603.         od_printf("\r            \r");
  3604.         //if(key=='\n' || key=='\r') key='Y';
  3605.         //od_putch(key);
  3606.         cnt=1;
  3607.         if(key=='N')
  3608.           return;
  3609.         else if(key=='=')
  3610.           nonstop=TRUE;
  3611.  
  3612. //              WaitForEnter();
  3613.  
  3614.         //od_printf("\n\r\n\r");
  3615.         scr_file=ShareFileOpen(SCR_FILENAME,"rb");
  3616.         fseek(scr_file,filepos,SEEK_SET);
  3617.           }
  3618.         }
  3619.         rnk++;
  3620.       }
  3621.       fclose(scr_file);
  3622.  
  3623.       if(rip) od_send_file("FRAME1.RIP");
  3624.       WaitForEnter();
  3625.     }
  3626. }
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632. /*online player listing*/
  3633. void
  3634. WhosOnline(void)
  3635. {
  3636.   FILE *scr_file;
  3637.   scr_rec user_scr;
  3638.   long filepos;
  3639.   int cnt,rnk;
  3640.   int nonstop=FALSE;
  3641.   char key;
  3642.  
  3643.  
  3644.   if(oneframe==FALSE || rip==FALSE) {
  3645.     od_printf("\n\r\n");
  3646.     ny_clr_scr();
  3647.     if(rip) od_send_file("FRAME.RIP");
  3648.     if(rip) od_send_file("FRAME3.RIP");
  3649.   } else {
  3650.     od_disp_str("\n\r!|e\n\r");
  3651.     od_send_file("FRAME3.RIP");
  3652.   }
  3653.  
  3654.   ny_send_menu(ONLINE,"");
  3655.  
  3656. /*  od_printf("`bright green`O`green`nline `bright green`P`green`layer `bright green`L`green`isting `bright green`F`green`or `bright red`N`red`ew `bright red`Y`red`ork `bright red`2008\n\r\n\r");
  3657.   od_printf("`green`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  3658.   od_printf("`cyan`Rank: Lvl: Name:                     Points:              S: T:\n\r");*/
  3659.   ch_game_d();
  3660.   if ((scr_file=ShareFileOpen(SCR_FILENAME,"rb"))!=NULL) {
  3661.     cnt=5;
  3662.     rnk=1;
  3663.     while (ny_fread(&user_scr, sizeof(scr_rec), 1, scr_file) == 1) {
  3664.       if (user_scr.online==TRUE) {
  3665.     PlInfo(&user_scr,cnt);
  3666.  
  3667.     cnt++;
  3668.     if (nonstop==FALSE && cnt%od_control.user_screen_length==0) {
  3669.       filepos=ftell(scr_file);
  3670.       fclose(scr_file);
  3671.  
  3672.       ny_disp_emu("`%More (Y/n/=)");
  3673.       key=ny_get_answer("YN=\n\r");
  3674.       od_printf("\r            \r");
  3675.       //if(key=='\n' || key=='\r') key='Y';
  3676.       //od_putch(key);
  3677.       cnt=1;
  3678.       if(key=='N')
  3679.         return;
  3680.       else if(key=='=')
  3681.         nonstop=TRUE;
  3682.  
  3683. //        WaitForEnter();
  3684.  
  3685.       //od_printf("\n\r");
  3686.       scr_file=ShareFileOpen(SCR_FILENAME,"rb");
  3687.       fseek(scr_file,filepos,SEEK_SET);
  3688.     }
  3689.       }
  3690.       rnk++;
  3691.     }
  3692.     fclose(scr_file);
  3693.  
  3694.     if(rip) od_send_file("FRAME1.RIP");
  3695.     WaitForEnter();
  3696.   }
  3697. }
  3698.  
  3699.  
  3700. void
  3701. EnterStreet(void)
  3702.     {
  3703.     char key;
  3704. //      int intval;
  3705.  
  3706. //      printf("\n\r14\n\r");
  3707.     read_IGMs();
  3708. //      printf("\n\r20\n\r");
  3709.     read_fight_IGMs();
  3710. //      printf("\n\rEND DEBUG!\n\r");
  3711.     noevents=FALSE;
  3712.  
  3713.     //if conversion from v0.05a or lower
  3714.     if(cur_user.throwing_ability==0) {
  3715.       cur_user.rocks=2;
  3716.       switch(cur_user.nation) {
  3717.         case HEADBANGER:
  3718.           cur_user.throwing_ability=10 + (cur_user.level*1.33);
  3719.           cur_user.punch_ability=10 + (cur_user.level*1.33);
  3720.           cur_user.kick_ability=20 + (cur_user.level*1.33);
  3721.           break;
  3722.         case HIPPIE:
  3723.           cur_user.throwing_ability=20 + (cur_user.level*1.33);
  3724.           cur_user.punch_ability=10 + (cur_user.level*1.33);
  3725.           cur_user.kick_ability=10 + (cur_user.level*1.33);
  3726.           break;
  3727.         case BIG_FAT_DUDE:
  3728.           cur_user.throwing_ability=4 + (cur_user.level*1.33);
  3729.           cur_user.punch_ability=18 + (cur_user.level*1.33);
  3730.           cur_user.kick_ability=18 + (cur_user.level*1.33);
  3731.           break;
  3732.         case CRACK_ADDICT:
  3733.           cur_user.throwing_ability=14 + (cur_user.level*1.33);
  3734.           cur_user.punch_ability=13 + (cur_user.level*1.33);
  3735.           cur_user.kick_ability=13 + (cur_user.level*1.33);
  3736.           break;
  3737.         case PUNK:
  3738.           cur_user.throwing_ability=11 + (cur_user.level*1.33);
  3739.           cur_user.punch_ability=20 + (cur_user.level*1.33);
  3740.           cur_user.kick_ability=11 + (cur_user.level*1.33);
  3741.           break;
  3742.       }
  3743.     }
  3744.  
  3745.     if (cur_user.hunger==100) {   //user dying of hunger
  3746.       od_printf("\n\r\n\r");
  3747.       ny_clr_scr();
  3748.       //if(rip) od_send_file("FRAME.RIP");
  3749.  
  3750.       //od_printf("`bright red`B`red`oy yer dying of hunger... If you don't eat today yer gonna die!\n\r");
  3751.       ny_line(53,0,1);
  3752. //        ny_disp_emu("`@B`4oy yer dying of hunger... If you don't eat today yer gonna die!\n\r");
  3753.  
  3754.       if(!rip)
  3755.         WaitForEnter();
  3756.       else
  3757.         od_get_answer("\n\r");
  3758.       food_ops();
  3759.       }
  3760.  
  3761.     else if (cur_user.hunger>=50) {  //user 50% or more hungry....cmon eat
  3762.       od_printf("\n\r\n\r");
  3763.       ny_clr_scr();
  3764.  
  3765.       //if(rip) od_send_file("FRAME.RIP");
  3766. //        od_printf("`bright red`B`red`oy yer hungry....you should eat something not to starve...\n\r");
  3767.       ny_line(52,0,1);
  3768. //        ny_disp_emu("`@B`4oy yer hungry....you should eat something not to starve...\n\r");
  3769.  
  3770.       if(!rip)
  3771.         WaitForEnter();
  3772.       else
  3773.         od_get_answer("\n\r");
  3774.       food_ops();
  3775.       }
  3776.  
  3777.     if(expert==3) expert=1;
  3778.     do {
  3779.         //key=central_park(); //display menu and get the key pressed
  3780.         if(!ibbs)
  3781.           key=callmenu("SCPFDAGUMIXEBHYWLRNOKQ!?\n\r",CENTRAL_PARK,342,FALSE);
  3782.         else
  3783.           key=callmenu("SCPFDAGUMIXEBHYWLRNO*KQ!?\n\r",CENTRAL_PARK_IB,342,FALSE);
  3784.         while (expert>0 && key=='?') {
  3785.           expert+=20;
  3786.           if(!ibbs)
  3787.             key=callmenu("SCPFDAGUMIXEBHYWLRNOKQ!?\n\r",CENTRAL_PARK,342,FALSE);
  3788.           else
  3789.             key=callmenu("SCPFDAGUMIXEBHYWLRNO*KQ!?\n\r",CENTRAL_PARK_IB,342,FALSE);
  3790.           expert-=20;
  3791.         }
  3792.  
  3793.         //go to the right ops function
  3794.         switch (key) {
  3795.           case 'D':               //buy sell use drugs
  3796.             if(expert==3) expert=1;
  3797.             drug_ops();
  3798.             if(expert==3) expert=1;
  3799.             break;
  3800.           case 'B':        //money and stuff...bank...
  3801.             if(expert==3) expert=1;
  3802.             money_ops();
  3803.             if(expert==3) expert=1;
  3804.             break;
  3805.           case 'R':         //rest somewhere.....
  3806.             if(expert==3) expert=1;
  3807.             rest_ops();
  3808.             if(expert==3) expert=1;
  3809.             break;
  3810.           case 'Y':       // display user stats
  3811.             DisplayStats();
  3812.             WaitForEnter();
  3813.             break;
  3814.           case 'L':         // list active players
  3815.             ListPlayers();
  3816.             break;
  3817.           case 'O':         // IGM (other stuff)
  3818.             if(expert==3) expert=1;
  3819.             IGM_ops();
  3820.             if(expert==3) expert=1;
  3821.             break;
  3822.           case 'M':         /// mail
  3823.             if(expert==3) expert=1;
  3824.             mail_ops();
  3825.             if(expert==3) expert=1;
  3826.             break;
  3827.           case 'W':         // Who's Online
  3828.             WhosOnline();
  3829.             break;
  3830.           case 'G':         // get laid.....
  3831.             if(expert==3) expert=1;
  3832.             get_laid_ops();
  3833.             if(expert==3) expert=1;
  3834.             break;
  3835.           case 'F':          // eat some food
  3836.             if(expert==3) expert=1;
  3837.             food_ops();
  3838.             if(expert==3) expert=1;
  3839.             break;
  3840.           case 'A':          //weapon store
  3841.             if(expert==3) expert=1;
  3842.             guns_ops();
  3843.             if(expert==3) expert=1;
  3844.             break;
  3845.           case '*':
  3846.             if (ibbs) {          //InterBBS
  3847.               if(expert==3) expert=1;
  3848.               ibbs_ops();
  3849.               if(expert==3) expert=1;
  3850.             }
  3851.             break;
  3852.           case 'H':         //healing (drug rehab, heal woulnds, cure std's)
  3853.             if(expert==3) expert=1;
  3854.             healing_ops();
  3855.             if(expert==3) expert=1;
  3856.             break;
  3857.           case 'E':
  3858.             if(expert==3) expert=1;
  3859.             evil_ops(&cur_user);
  3860.             if(expert==3) expert=1;
  3861.             break;
  3862.           case 'S':             //street fights
  3863.             if(expert==3) expert=1;
  3864.             fight_ops(&cur_user);
  3865.             if(expert==3) expert=1;
  3866.             break;
  3867.           case 'K':             //suicide
  3868.             ny_line(54,2,0);
  3869.             key=ny_get_answer("YN");
  3870.             if(!rip)
  3871.               od_printf("%c\n\r",key);
  3872.             else if(key=='Y') {
  3873.               od_disp_str("\n\r!|10((*REALLY want to DIE?::y@Yes,n@No))|#|#|#\n\r");
  3874.               key=od_get_answer("YN");
  3875.             }
  3876.             if (key=='Y')
  3877.               Die(4);
  3878.             else if(rip)
  3879.               no_rip_m=1;
  3880.             break;
  3881.           case 'I':
  3882.             if(registered==FALSE) {
  3883.               ny_disp_emu("`%\n\r\n\rUNREGISTERED!!!\n\r\n\rCannot do this!!!\n\r");
  3884.               WaitForEnter();
  3885.             } else {
  3886.               if(expert==3) expert=1;
  3887.               change_info();
  3888.               if(expert==3) expert=1;
  3889.             }
  3890.             break;
  3891.         case '!':               //instructions
  3892.           od_printf("\n\r\n\r");
  3893.           ny_clr_scr();
  3894.           ch_game_d();
  3895.           if(rip) od_send_file("FRAME.RIP");
  3896.           if(rip) od_send_file("FRAME3.RIP");
  3897.           if(clean_mode==TRUE)
  3898.             ny_send_file("NYINSTRC.ASC");
  3899.           else
  3900.             ny_send_file("NYINSTR.ASC");
  3901.           if(rip) od_send_file("FRAME1.RIP");
  3902.           WaitForEnter();
  3903.           break;
  3904.         case 'C': // copfights
  3905.           if(registered==FALSE) {
  3906.             ny_disp_emu("`%\n\r\n\rUNREGISTERED!!!\n\r\n\rCannot do this!!!\n\r");
  3907.             WaitForEnter();
  3908.           } else {
  3909.             if(expert==3) expert=1;
  3910.             copfight_ops(&cur_user);
  3911.             if(expert==3) expert=1;
  3912.           }
  3913.           break;
  3914.         case 'P': // Player fights
  3915.           if(expert==3) expert=1;
  3916.           p_fight_ops(&cur_user,&nCurrentUserNumber);
  3917.           if(expert==3) expert=1;
  3918.           break;
  3919.         case 'N':  //newz
  3920.           newz_ops();
  3921.           break;
  3922.         case 'X':
  3923.           if(expert==3) expert=1;
  3924.           if(rip) {
  3925.             expert=0;
  3926.           } else {
  3927.             expert+=1;//expert;
  3928.             if(expert>2) expert=0;
  3929.             if (expert==2) { //expert
  3930.               ny_line(55,2,1);
  3931.             } else if(expert==1) { //regular
  3932.               ny_line(56,2,1);
  3933.             } else { //novice
  3934.               ny_line(341,2,1);
  3935.             }
  3936.             WaitForEnter();
  3937.           }
  3938.           break;
  3939.         case 'Q':
  3940.           ny_line(57,2,0);
  3941.           key=ny_get_answer("YN");
  3942.           if(!rip)
  3943.             od_printf("%c\n\r",key);
  3944.           else
  3945.             od_disp_str("\n\r");
  3946.           if (key=='Y')
  3947.             key='Q';
  3948.           else if(!rip)
  3949.             no_rip_m=1;
  3950.           break;
  3951.         case 'U':           //use a-bomb to win game
  3952.           //only if user got one
  3953.           if (cur_user.arm!=A_BOMB) {
  3954.             ny_line(58,2,1);
  3955.             if(!rip)
  3956.               WaitForEnter();
  3957.             else {
  3958.               od_get_answer("\n\r");
  3959.               no_rip_m=1;
  3960.             }
  3961.           } else {
  3962.             ny_line(59,2,0);
  3963. //                  od_printf("`bright red`\n\r\n\rR`red`eally do it? (`bright red`Y`red`/`bright red`N`red`)");
  3964.             key=ny_get_answer("YN");
  3965.             if(!rip)
  3966.               od_printf("%c\n\r",key);
  3967.             else
  3968.               od_disp_str("\n\r");
  3969.             if (key=='Y') {
  3970.               cur_user.alive=DEAD;
  3971.               wrt_sts();
  3972.               od_printf("\n\r\n\r");
  3973.               ny_clr_scr();
  3974.               od_send_file("WIN");
  3975.               ny_line(1,1,0);
  3976.               od_get_answer("\n\r");
  3977.  
  3978.               od_printf("\n\r\n\r");
  3979.               ny_clr_scr();
  3980.  
  3981.               ny_line(295,2,0);
  3982. //                    od_printf("\n\r\n\r`bright`YOU WON THE GAME!!!!! With
  3983.               od_printf(D_Num(cur_user.points));
  3984.               ny_line(296,0,2);
  3985.               ny_send_menu(WIN,"");
  3986.           /*  od_printf("\n\r\n\r\n\r`white`Of course blowing up New York with an A-Bomb did wonders to your body\n\r");
  3987.               od_printf("basically what I'm saying you died... but you completed yer mission ...\n\r");
  3988.               od_printf("just think of all the people that died with you ...\n\r\n\r");*/
  3989.               news_post("`%WON `4THE GAME .... `@LOOSERS ....",cur_user.name,"",3);
  3990.               AddBestPlayer();
  3991.               if(ibbs)
  3992.             AddBestPlayerIB();
  3993.               ny_line(1,1,0);
  3994.               od_get_answer("\n\r");
  3995.               od_exit(10,FALSE);
  3996.             }
  3997.           }
  3998.           break;
  3999.          }
  4000.       } while (key!='Q');
  4001. }
  4002.  
  4003.  
  4004.  
  4005.  
  4006. char *D_Num(int num)
  4007. {
  4008.   char temp[8];
  4009.   int cnt,cnt2,len,sign=0;
  4010.   if (num<0) {
  4011.     sign=1;
  4012.     str[0]='-';
  4013.   }
  4014.  
  4015.   sprintf(temp,"%d",num);
  4016.  
  4017.   len=strlen(temp);
  4018.  
  4019.   if (len<=4) {
  4020.     strcpy(str,temp);
  4021.     return str;
  4022.   }
  4023.  
  4024.   cnt2=sign;
  4025.   for(cnt=sign;cnt<len-1;cnt++) {
  4026.     str[cnt2]=temp[cnt];
  4027.     if ( ( (int)((len-cnt-.00099)/3) *3) == (len-cnt-1) ) {
  4028.       cnt2++;
  4029.       str[cnt2]=',';
  4030.     }
  4031.     cnt2++;
  4032.   }
  4033.   str[cnt2]=temp[cnt];
  4034.   str[cnt2+1]=0;
  4035.   return str;
  4036. }
  4037.  
  4038.  
  4039.  
  4040. char *D_Num(long num)
  4041. {
  4042.   char temp[15];
  4043.   int cnt,cnt2,len,sign=0;
  4044.   if (num<0) {
  4045.     sign=1;
  4046.     str[0]='-';
  4047.   }
  4048.  
  4049.   sprintf(temp,"%ld",num);
  4050.  
  4051.   len=strlen(temp);
  4052.  
  4053.   if (len<=4) {
  4054.     strcpy(str,temp);
  4055.     return str;
  4056.   }
  4057.  
  4058.   cnt2=sign;
  4059.   for(cnt=sign;cnt<len-1;cnt++) {
  4060.     str[cnt2]=temp[cnt];
  4061.     if ( ((int)((len-cnt-.00099)/3)*3) == (len-cnt-1) ) {
  4062.       cnt2++;
  4063.       str[cnt2]=',';
  4064.     }
  4065.     cnt2++;
  4066.   }
  4067.   str[cnt2]=temp[cnt];
  4068.   str[cnt2+1]=0;
  4069.  
  4070.   return str;
  4071. }
  4072.  
  4073. char *D_Num(unsigned long num)
  4074. {
  4075.   char temp[14];
  4076.   int cnt,cnt2,len;
  4077.  
  4078.   sprintf(temp,"%lu",num);
  4079.  
  4080.   len=strlen(temp);
  4081.  
  4082.   if (len<=4) {
  4083.     strcpy(str,temp);
  4084.     return str;
  4085.   }
  4086.  
  4087.   cnt2=0;
  4088.   for(cnt=0;cnt<len-1;cnt++) {
  4089.     str[cnt2]=temp[cnt];
  4090.     if ( ((int)((len-cnt-.00099)/3)*3) == (len-cnt-1) ) {
  4091.       cnt2++;
  4092.       str[cnt2]=',';
  4093.     }
  4094.     cnt2++;
  4095.   }
  4096.   str[cnt2]=temp[cnt];
  4097.   str[cnt2+1]=0;
  4098.  
  4099.   return str;
  4100. }
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107. void
  4108. points_raise(unsigned long raise)
  4109. {       // when is time for next level      0   1    2    3    4    5    6     7     8     9     10    11    12    13    14    15    16    17     18     19      //20
  4110.     unsigned long level_seal[LEVELS] = {500,1020,2100,3700,6100,9100,12820,17300,22580,28700,35700,43620,52500,62380,73300,85300,98420,112700,128180,144900};//,162900};
  4111.     char c_dir,key;
  4112.  
  4113.     c_dir=c_dir_g;
  4114.  
  4115.     cur_user.points+=raise * DrgPtsCoef();
  4116.  
  4117.  
  4118.     if(cur_user.points>30000 && registered==FALSE) {
  4119.       if(rip) {
  4120.         scr_save();
  4121.         ny_clr_scr();
  4122.         od_send_file("FRAME.RIP");
  4123.         od_send_file("FRAME1.RIP");
  4124.       }
  4125.  
  4126.       ny_disp_emu("`%\n\r\n\rUNREGISTERED!!!\n\r\n\r");
  4127.       ny_disp_emu("You reached 30,000 points, and this game is `$UNREGISTERED`%!\n\r");
  4128.       ny_disp_emu("This nag screen will appear to you every time your points raise\n\r");
  4129.       ny_disp_emu("And you can't get into level 10, until the game is registered\n\r");
  4130.       ny_disp_emu("Otherwise nothing will happen, please tell the sysop to register the game!\n\r");
  4131.       WaitForEnter();
  4132.       if(rip)
  4133.         scr_res();
  4134.     }
  4135.  
  4136.  
  4137.     if(registered==FALSE && cur_user.level>9)
  4138.       cur_user.level=9;
  4139.  
  4140.  
  4141.  
  4142.     while (cur_user.level<20 && level_seal[cur_user.level]<=cur_user.points) {
  4143.     //while ( (pow( 10,((double)cur_user.level+1)/2) ) * 25 )<=cur_user.points) {
  4144.       if(cur_user.level>=9 && registered==FALSE) break;
  4145.  
  4146.       cur_user.level++;
  4147.       switch(cur_user.nation) {
  4148.         case HEADBANGER:
  4149.           cur_user.strength=(5 * pow(1.3,cur_user.level)+.5);
  4150.           cur_user.defense=(4 * pow(1.3,cur_user.level)+.5);
  4151.           break;
  4152.         case HIPPIE:
  4153.           cur_user.strength=(4 * pow(1.3,cur_user.level)+.5);
  4154.           cur_user.defense=(4 * pow(1.3,cur_user.level)+.5);
  4155.           break;
  4156.         case BIG_FAT_DUDE:
  4157.           cur_user.strength=(3 * pow(1.3,cur_user.level)+.5);
  4158.           cur_user.defense=(6 * pow(1.3,cur_user.level)+.5);
  4159.           break;
  4160.         case CRACK_ADDICT:
  4161.           cur_user.strength=(4 * pow(1.3,cur_user.level)+.5);
  4162.           cur_user.defense=(5 * pow(1.3,cur_user.level)+.5);
  4163.           break;
  4164.         case PUNK:
  4165.           cur_user.strength=(6 * pow(1.3,cur_user.level)+.5);
  4166.           cur_user.defense=(3 * pow(1.3,cur_user.level)+.5);
  4167.           break;
  4168.       }
  4169.       cur_user.hitpoints+=.7 * cur_user.maxhitpoints;
  4170.       cur_user.maxhitpoints=(15 * pow(1.7,cur_user.level)+.5);
  4171.  
  4172.       ny_line(60,2,0);
  4173.       //Yer level has been raised to level
  4174.       if(!rip) {
  4175.         od_printf("%d`red`!\n\r",(int)cur_user.level);
  4176.         ny_line(437,1,0);
  4177.         key=od_get_answer("TKP");
  4178.         od_printf("%c\n\r",key);
  4179.       } else {
  4180.         od_printf("%d\\!::^M",(int)cur_user.level);
  4181.         od_putch('@');
  4182.         od_printf("OK))|#|#|#\n\r");
  4183.         od_get_answer("\n\r");
  4184.         ny_line(437,1,1);
  4185.         key=od_get_answer("TKP");
  4186.       }
  4187.       switch(key) {
  4188.         case 'T':
  4189.           cur_user.throwing_ability+=4; break;
  4190.         case 'K':
  4191.           cur_user.kick_ability+=4; break;
  4192.         case 'P':
  4193.           cur_user.punch_ability+=4; break;
  4194.       }
  4195.  
  4196.       cur_user.sex_today++;
  4197.     }
  4198.  
  4199.  
  4200.     wrt_sts();
  4201.  
  4202.     SortScrFile(nCurrentUserNumber,0);
  4203.  
  4204.     if(c_dir==0)
  4205.       ch_game_d();
  4206.     else
  4207.       ch_flag_d();
  4208.  
  4209.     od_control.od_update_status_now=TRUE;
  4210. }
  4211.  
  4212.  
  4213. void
  4214. points_loose(unsigned long lost)
  4215. {
  4216.     char c_dir;
  4217.  
  4218.     c_dir=c_dir_g;
  4219.     if (cur_user.points<lost)
  4220.       cur_user.points=0;
  4221.     else
  4222.       cur_user.points-=lost;
  4223.  
  4224.     wrt_sts();
  4225.     SortScrFileB(nCurrentUserNumber);
  4226.     if(c_dir==0)
  4227.       ch_game_d();
  4228.     else
  4229.       ch_flag_d();
  4230.     od_control.od_update_status_now=TRUE;
  4231. }
  4232.  
  4233.  
  4234. double
  4235. DrgPtsCoef(void)
  4236. {
  4237.   if (cur_user.nation!=HIPPIE) {
  4238.     if (cur_user.drug==POT) return (cur_user.drug_high/1000.0) + 1.0;
  4239.     if (cur_user.drug==HASH) return (cur_user.drug_high/500.0) + 1.0;
  4240.     if (cur_user.drug==LSD) return (cur_user.drug_high/250.0) + 1.0;
  4241.     return 1.0;
  4242.   }
  4243.   if (cur_user.drug==POT) return (cur_user.drug_high/900.0) + 1.0;
  4244.   if (cur_user.drug==HASH) return (cur_user.drug_high/450.0) + 1.0;
  4245.   if (cur_user.drug==LSD) return (cur_user.drug_high/225.0) + 1.0;
  4246.   return 1.01;
  4247.  
  4248. }
  4249.  
  4250. char
  4251. callmenu(char allowed[],menu_t menu,int menu_line,char figst)
  4252. {
  4253.   char key;
  4254.  
  4255.   od_clear_keybuffer();
  4256.  
  4257.   if(no_rip_m!=1 || !rip) {
  4258.  
  4259.     od_printf("\n\r\n\r");
  4260.     if (expert!=2 && expert!=3) ny_clr_scr();
  4261.  
  4262.     if (expert==2 || expert==3) {
  4263.       ny_line(menu_line,0,1);
  4264.       od_printf(allowed);
  4265.       ny_line(36,0,0);
  4266.       od_printf("%d ",od_control.caller_timelimit);
  4267.       ny_line(37,0,0);
  4268.       //od_printf("`bright green`%s`bright blue`E`blue`nter `bright blue`Y`blue`er `bright blue`C`blue`ommand (%d mins)`bright blue`>",allowed,od_control.caller_timelimit);
  4269.       if(rip) od_disp_str("\n\r!|10$HKEYON$|#|#|#\n\r");
  4270.       key=ny_get_answer(allowed);
  4271.       if(rip) od_disp_str("\n\r!|10$HKEYOFF$|#|#|#\n\r");
  4272.     } else {
  4273.       if(figst && !rip) {
  4274.     ny_line(menu_line,0,2);
  4275.     disp_fig_stats();
  4276.       }
  4277.       key=ny_send_menu(menu,allowed);
  4278.  
  4279.       if(!rip) {
  4280.     ny_line(36,0,0);
  4281.     od_printf("%d ",od_control.caller_timelimit);
  4282.     ny_line(37,0,0);
  4283.       }
  4284.  
  4285.       if (key==0) {
  4286.     if(rip) od_disp_str("\n\r!|10$HKEYON$|#|#|#\n\r");
  4287.     key= ny_get_answer(allowed);
  4288.     if(rip) od_disp_str("\n\r!|10$HKEYOFF$|#|#|#\n\r");
  4289.       }
  4290.  
  4291.     }
  4292.   } else {
  4293.     no_rip_m=0;
  4294.     od_disp_str("\n\r!|10$HKEYON$|#|#|#\n\r");
  4295.     key=ny_get_answer(allowed);
  4296.     od_disp_str("\n\r!|10$HKEYOFF$|#|#|#\n\r");
  4297.   }
  4298.   if (menu!=CENTRAL_PARK && menu!=CENTRAL_PARK_IB && (key=='\n' || key=='\r')) key='Q';
  4299.   if(!rip) od_putch(key);
  4300.   if(expert==1) expert=3;
  4301.   return key;
  4302. }
  4303.  
  4304.  
  4305.  
  4306.  
  4307. void
  4308. rest_ops(void)
  4309. {
  4310.     char key,s_key;
  4311.     unsigned long intval;
  4312.     unsigned long max;
  4313.  
  4314.     do {
  4315.       key=callmenu("CERYQ?\n\r",REST,343,FALSE);
  4316.       while (expert>0 && key=='?') {
  4317.         expert+=10;
  4318.         key=callmenu("CERYQ?\n\r",REST,343,FALSE);
  4319.         expert-=10;
  4320.       }
  4321.  
  4322.  
  4323.       if (key=='Y') {
  4324.         DisplayStats();
  4325.         WaitForEnter();
  4326.       }
  4327.       else if (key=='C') {
  4328.         if (cur_user.rest_where!=NOWHERE && cur_user.rest_where!=MOTEL) {
  4329.  
  4330.           ny_line(61,2,0);
  4331. //            od_printf("\n\r\n\r`bright red`Y`red`er already staying at: `bright green`");
  4332.           //if (cur_user.rest_where==MOTEL) od_printf("C`green`heap `bright green`M`green`otel");
  4333.           if(!rip) {
  4334.         if (cur_user.rest_where==REG_HOTEL) od_printf("R`green`egular `bright green`H`green`otel");
  4335.         else if (cur_user.rest_where==EXP_HOTEL) od_printf("E`green`xpensive `bright green`H`green`otel");
  4336.           } else {
  4337.         if (cur_user.rest_where==REG_HOTEL) od_printf(" Regular Hotel::@OK))|#|#|#\n\r");
  4338.         else if (cur_user.rest_where==EXP_HOTEL) od_printf(" Expensive Hotel::@OK))|#|#|#\n\r");
  4339.           }
  4340.  
  4341.           ny_line(62,2,0);
  4342. //            od_printf("\n\r`bright red`W`red`anna check outta there (no money back)? (`bright red`Y`red`/`bright red`N`red`)");
  4343.  
  4344.           s_key=ny_get_answer("YN");
  4345.           od_putch(s_key);
  4346.           if (s_key=='Y') goto Cheap_motel_ok;
  4347.           if(rip) no_rip_m=1;
  4348.         } else {
  4349. Cheap_motel_ok:;
  4350.           intval=(cur_user.level*20)+20;
  4351.  
  4352.           ny_line(297,2,0);
  4353.           //od_printf("\n\r\n\r`bright red`I`red`t will cost ya `bright red`
  4354.           od_printf(D_Num(intval));
  4355.           ny_line(298,0,0);
  4356. //            `red` per day.",intval);// still wanna do it(`bright red`Y`red`/`bright red`N`red`)",intval);
  4357.           max=cur_user.money/intval;
  4358.           if (max>255) max=255;
  4359.           if(rip)
  4360.         od_get_answer("\n\r");
  4361.           ny_line(299,2,0);
  4362. //            od_printf("\n\r`bright red`Y`red`ou can afford `bright red`
  4363.           od_printf(D_Num(max));
  4364.           ny_line(300,0,2);
  4365.           if(rip) {
  4366.         od_get_answer("\n\r");
  4367.   //          `red` days!\n\r",D_Num(max));
  4368.         od_send_file("input.rip");
  4369.           }
  4370.           ny_line(301,0,0);
  4371.           //od_printf("`bright green`H`green`ow mady days ya wanna stay here? (`bright blue`Enter`green`=`bright green`[0]`green`, `bright blue`M`green`=max `bright green`
  4372.           od_printf(D_Num(max));
  4373.           ny_disp_emu("`2):");
  4374.  
  4375.           max=get_val((unsigned long)0,(unsigned long)max);
  4376.           if (max==0) {
  4377.         //if (intval>cur_user.money) {
  4378.         //  if (cur_user.rest_where==NOWHERE) {
  4379.         //    od_printf("`bright red`Y`red`a cant afford that...\n\r");
  4380.         //  } else {
  4381.  
  4382.         if (cur_user.rest_where!=NOWHERE) {
  4383.           ny_line(63,1,0);
  4384.           //od_printf("`bright red`Y`red`e're still staying at: ");
  4385.           if(!rip) {
  4386.             if (cur_user.rest_where==MOTEL) od_printf("C`green`heap `bright green`M`green`otel");
  4387.             else if (cur_user.rest_where==REG_HOTEL) od_printf("R`green`egular `bright green`H`green`otel");
  4388.             else if (cur_user.rest_where==EXP_HOTEL) od_printf("E`green`xpensive `bright green`H`green`otel");
  4389.           } else {
  4390.             if (cur_user.rest_where==MOTEL) od_printf("Cheap Motel::@OK))|#|#|#");
  4391.             else if (cur_user.rest_where==REG_HOTEL) od_printf(" Regular Hotel::@OK))|#|#|#\n\r");
  4392.             else if (cur_user.rest_where==EXP_HOTEL) od_printf(" Expensive Hotel::@OK))|#|#|#\n\r");
  4393.           }
  4394.  
  4395.           od_printf("\n\r");
  4396.           if (rip==FALSE) WaitForEnter();
  4397.         }
  4398.           } else {
  4399.  
  4400.         ny_line(64,1,1);
  4401.         //od_printf("`bright red`O`red`k dude you got it...\n\r");
  4402.         money_minus(intval*max);
  4403.         if (cur_user.rest_where==MOTEL)
  4404.           cur_user.hotel_paid_fer+=max;
  4405.         else
  4406.           cur_user.hotel_paid_fer=max;
  4407.         cur_user.rest_where=MOTEL;
  4408.  
  4409.         od_exit(10,FALSE);
  4410.           }
  4411.         }
  4412.       }
  4413.       else if (key=='R') {
  4414.         if (cur_user.rest_where!=NOWHERE && cur_user.rest_where!=REG_HOTEL) {
  4415.  
  4416.           ny_line(61,2,0);
  4417.           //od_printf("\n\r\n\r`bright red`Y`red`er already staying at: ");
  4418.           if(!rip) {
  4419.         if (cur_user.rest_where==MOTEL) od_printf("C`green`heap `bright green`M`green`otel");
  4420.         else if (cur_user.rest_where==EXP_HOTEL) od_printf("E`green`xpensive `bright green`H`green`otel");
  4421.           } else {
  4422.         if (cur_user.rest_where==MOTEL) od_printf("Cheap Motel::@OK))|#|#|#");
  4423.         else if (cur_user.rest_where==EXP_HOTEL) od_printf(" Expensive Hotel::@OK))|#|#|#\n\r");
  4424.           }
  4425.           ny_line(62,2,0);
  4426.           //od_printf(" `bright red`W`red`anna check outta there (no money back)? (`bright red`Y`red`/`bright red`N`red`)");
  4427.  
  4428.           s_key=ny_get_answer("YN");
  4429.           od_putch(s_key);
  4430.           if (s_key=='Y') goto Reg_hotel_ok;
  4431.           if(rip) no_rip_m=1;
  4432.         } else {
  4433. Reg_hotel_ok:;
  4434.           intval=(cur_user.level*40)+40;
  4435.  
  4436.           ny_line(297,2,0);
  4437.           od_printf(D_Num(intval));
  4438.           ny_line(298,0,0);
  4439. //            od_printf("\n\r\n\r`bright red`I`red`t will cost ya `bright red`%d`red` per day.",intval);// still wanna do it(`bright red`Y`red`/`bright red`N`red`)",intval);
  4440.           max=cur_user.money/intval;
  4441.           if(rip)
  4442.         od_get_answer("\n\r");
  4443.           if (max>255) max=255;
  4444.           ny_line(299,2,0);
  4445.           od_printf(D_Num(max));
  4446.           ny_line(300,0,2);
  4447. //            od_printf("\n\r`bright red`Y`red`ou can afford `bright red`%s`red` days!\n\r",D_Num(max));
  4448.           if(rip) {
  4449.         od_get_answer("\n\r");
  4450.         od_send_file("input.rip");
  4451.           }
  4452.           ny_line(301,0,0);
  4453.           od_printf(D_Num(max));
  4454.           ny_disp_emu("`2):");
  4455.           //od_printf("`bright green`H`green`ow mady days ya wanna stay here? (`bright blue`Enter`green`=`bright green`[0]`green`, `bright blue`M`green`=max `bright green`%d`green`):",max);
  4456.  
  4457.           max=get_val((unsigned long)0,(unsigned long)max);
  4458.           if (max==0) {
  4459.         //if (intval>cur_user.money) {
  4460.         //  if (cur_user.rest_where==NOWHERE) {
  4461.         //    od_printf("`bright red`Y`red`a cant afford that...\n\r");
  4462.         //  } else {
  4463.  
  4464.         if (cur_user.rest_where!=NOWHERE) {
  4465.           ny_line(63,1,0);
  4466.           //od_printf("`bright red`Y`red`e're still staying at: ");
  4467.           if(!rip) {
  4468.             if (cur_user.rest_where==MOTEL) od_printf("C`green`heap `bright green`M`green`otel");
  4469.             else if (cur_user.rest_where==REG_HOTEL) od_printf("R`green`egular `bright green`H`green`otel");
  4470.             else if (cur_user.rest_where==EXP_HOTEL) od_printf("E`green`xpensive `bright green`H`green`otel");
  4471.           } else {
  4472.             if (cur_user.rest_where==MOTEL) od_printf("Cheap Motel::@OK))|#|#|#");
  4473.             else if (cur_user.rest_where==REG_HOTEL) od_printf(" Regular Hotel::@OK))|#|#|#\n\r");
  4474.             else if (cur_user.rest_where==EXP_HOTEL) od_printf(" Expensive Hotel::@OK))|#|#|#\n\r");
  4475.           }
  4476.  
  4477.  
  4478.           od_printf("\n\r");
  4479.           if (rip==FALSE) WaitForEnter();
  4480.         }
  4481.           } else {
  4482.  
  4483.         ny_line(64,1,1);
  4484.         //od_printf("`bright red`O`red`k dude you got it...\n\r");
  4485.         money_minus(intval*max);
  4486.         if (cur_user.rest_where==REG_HOTEL)
  4487.           cur_user.hotel_paid_fer+=max;
  4488.         else
  4489.           cur_user.hotel_paid_fer=max;
  4490.         //cur_user.rest_where=REG_HOTEL;
  4491.         //cur_user.hotel_paid_fer=max;
  4492.         od_exit(10,FALSE);
  4493.           }
  4494.         }
  4495.       }
  4496.       else if (key=='E') {
  4497.         if (cur_user.rest_where!=NOWHERE && cur_user.rest_where!=EXP_HOTEL) {
  4498.  
  4499.           ny_line(61,2,0);
  4500.           //od_printf("\n\r\n\r`bright red`Y`red`er already staying at: ");
  4501.           if(!rip) {
  4502.         if (cur_user.rest_where==MOTEL) od_printf("C`green`heap `bright green`M`green`otel");
  4503.         else if (cur_user.rest_where==REG_HOTEL) od_printf("R`green`egular `bright green`H`green`otel");
  4504.           } else {
  4505.         if (cur_user.rest_where==MOTEL) od_printf("Cheap Motel::@OK))|#|#|#");
  4506.         else if (cur_user.rest_where==REG_HOTEL) od_printf(" Regular Hotel::@OK))|#|#|#\n\r");
  4507.           }
  4508.           ny_line(62,2,0);
  4509.           //od_printf(" `bright red`W`red`anna check outta there (no money back)? (`bright red`Y`red`/`bright red`N`red`)");
  4510.  
  4511.           s_key=ny_get_answer("YN");
  4512.           od_putch(s_key);
  4513.           if (s_key=='Y') goto Exp_hotel_ok;
  4514.           if(rip) no_rip_m=1;
  4515.         } else {
  4516. Exp_hotel_ok:;
  4517.           intval=(cur_user.level*110)+110;
  4518.  
  4519.           ny_line(297,2,0);
  4520.           od_printf(D_Num(intval));
  4521.           ny_line(298,0,0);
  4522.           //od_printf("\n\r\n\r`bright red`I`red`t will cost ya `bright red`%d`red` per day.",intval);// still wanna do it(`bright red`Y`red`/`bright red`N`red`)",intval);
  4523.           max=cur_user.money/intval;
  4524.           if(rip)
  4525.         od_get_answer("\n\r");
  4526.           if (max>255) max=255;
  4527.           ny_line(299,2,0);
  4528.           od_printf(D_Num(max));
  4529.           ny_line(300,0,2);
  4530.           if(rip) {
  4531.         od_get_answer("\n\r");
  4532.           //od_printf("\n\r`bright red`Y`red`ou can afford `bright red`%s`red` days!\n\r",D_Num(max));
  4533.         od_send_file("input.rip");
  4534.           }
  4535.  
  4536.           ny_line(301,0,0);
  4537.           od_printf(D_Num(max));
  4538.           ny_disp_emu("`2):");
  4539.           //od_printf("`bright green`H`green`ow mady days ya wanna stay here? (`bright blue`Enter`green`=`bright green`[0]`green`, `bright blue`M`green`=max `bright green`%d`green`):",max);
  4540.  
  4541.           max=get_val((unsigned long)0,(unsigned long)max);
  4542.           if (max==0) {
  4543.         //if (intval>cur_user.money) {
  4544.         //  if (cur_user.rest_where==NOWHERE) {
  4545.         //    od_printf("`bright red`Y`red`a cant afford that...\n\r");
  4546.         //  } else {
  4547.  
  4548.         if (cur_user.rest_where!=NOWHERE) {
  4549.           ny_line(63,1,0);
  4550.           //od_printf("`bright red`Y`red`e're still staying at: ");
  4551.           if(!rip) {
  4552.             if (cur_user.rest_where==MOTEL) od_printf("C`green`heap `bright green`M`green`otel");
  4553.             else if (cur_user.rest_where==REG_HOTEL) od_printf("R`green`egular `bright green`H`green`otel");
  4554.             else if (cur_user.rest_where==EXP_HOTEL) od_printf("E`green`xpensive `bright green`H`green`otel");
  4555.           } else {
  4556.             if (cur_user.rest_where==MOTEL) od_printf("Cheap Motel::@OK))|#|#|#");
  4557.             else if (cur_user.rest_where==REG_HOTEL) od_printf(" Regular Hotel::@OK))|#|#|#\n\r");
  4558.             else if (cur_user.rest_where==EXP_HOTEL) od_printf(" Expensive Hotel::@OK))|#|#|#\n\r");
  4559.           }
  4560.           od_printf("\n\r");
  4561.  
  4562.           if (rip==FALSE) WaitForEnter();
  4563.         }
  4564.           } else {
  4565.  
  4566.         ny_line(64,1,1);
  4567.         //od_printf("`bright red`O`red`k dude you got it...\n\r");
  4568.         money_minus(intval*max);
  4569.         if (cur_user.rest_where==EXP_HOTEL)
  4570.           cur_user.hotel_paid_fer+=max;
  4571.         else
  4572.           cur_user.hotel_paid_fer=max;
  4573.         //cur_user.rest_where=EXP_HOTEL;
  4574.         //cur_user.hotel_paid_fer=max;
  4575.         od_exit(10,FALSE);
  4576.           }
  4577.         }
  4578.       }
  4579.     } while (key!='Q');
  4580. }
  4581.  
  4582.  
  4583.  
  4584. void
  4585. DisplayBest(void)
  4586. {
  4587. //  ffblk ffblk;
  4588.   best_rec_type best_rec;
  4589.   FILE *justfile;
  4590.   int cnt;
  4591.  
  4592.   ch_game_d();
  4593.   if (findfirst("NYBEST.TEN",&fff,0)==0) {
  4594.     justfile=ShareFileOpen("NYBEST.TEN","rb");
  4595.     od_printf("\n\r\n\r");
  4596.     ny_clr_scr();
  4597.     if(rip) od_send_file("FRAME.RIP");
  4598.     if(rip) od_send_file("FRAME1.RIP");
  4599.     ny_send_menu(TEN_BEST,"");
  4600.     cnt=1;
  4601. /*    od_printf("\n\r`bright red`T`red`en `bright red`B`red`est ... `bright red`W`red`inners\n\r\n\r");
  4602.     od_printf("`bright blue`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  4603.     od_printf("`cyan`Rank:    Name:                     Points:");*/
  4604.     while(ny_fread(&best_rec,sizeof(best_rec),1,justfile)==1) {
  4605.       od_printf("`bright red`%-2d       `bright green`",cnt);
  4606.       ny_disp_emu(best_rec.name,25);
  4607.       od_printf(" `bright red`%s\n\r",D_Num(best_rec.points));
  4608.       cnt++;
  4609.     }
  4610. //    od_printf("\n\r");
  4611.     ny_line(399,0,1);
  4612.     //ny_send_menu(BLUE_LINE,"");
  4613.     //od_printf("\n\r`bright blue`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  4614.     fclose(justfile);
  4615.     ny_line(1,1,0);
  4616. //    ny_disp_emu("\n\r`@Smack [ENTER] to go on.");
  4617.     od_get_answer("\n\r");
  4618.   }
  4619. }
  4620.  
  4621. void
  4622. DisplayBestIB(void)
  4623. {
  4624. //  ffblk ffblk;
  4625.   ibbs_best_rec_type best_rec;
  4626.   FILE *justfile;
  4627.   int cnt;
  4628.  
  4629.   ch_game_d();
  4630.   if (findfirst("NYIBBEST.TEN",&fff,0)==0) {
  4631.     justfile=ShareFileOpen("NYIBBEST.TEN","rb");
  4632.     od_printf("\n\r\n\r");
  4633.     ny_clr_scr();
  4634.     if(rip) od_send_file("FRAME.RIP");
  4635.     if(rip) od_send_file("FRAME1.RIP");
  4636.     ny_send_menu(TEN_BEST_IBBS,"");
  4637.     cnt=1;
  4638. /*    od_printf("\n\r`bright red`T`red`en `bright red`B`red`est ... `bright red`W`red`inners\n\r\n\r");
  4639.     od_printf("`bright blue`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  4640.     od_printf("`cyan`Rank:    Name:                     Points:");*/
  4641.     while(ny_fread(&best_rec,sizeof(best_rec),1,justfile)==1) {
  4642.       //findmeagain
  4643. //      od_printf("`bright red`%-2d       `bright green`",cnt);
  4644.       od_set_attrib(0x0a);
  4645.       ny_disp_emu(best_rec.name,25);
  4646.       od_printf(" `bright red`%-13s ",D_Num(best_rec.points));
  4647.       od_set_attrib(0x02);
  4648.       ny_disp_emu(LocationOf(best_rec.location));
  4649.       od_disp_str("\n\r");
  4650.       cnt++;
  4651.     }
  4652. //    od_printf("\n\r");
  4653.     ny_line(399,0,1);
  4654.     //ny_send_menu(BLUE_LINE,"");
  4655.     //od_printf("\n\r`bright blue`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  4656.     fclose(justfile);
  4657.     ny_line(1,1,0);
  4658. //    ny_disp_emu("\n\r`@Smack [ENTER] to go on.");
  4659.     od_get_answer("\n\r");
  4660.   }
  4661. }
  4662.  
  4663.  
  4664.  
  4665. void
  4666. AddBestPlayer(void)
  4667. {
  4668. //  ffblk ffblk;
  4669.   best_rec_type best_rec,best_rec2;
  4670.   FILE *justfile;
  4671.   int cnt=0,len_of_list;
  4672.   strcpy(best_rec2.name,cur_user.name);
  4673.   best_rec2.points=cur_user.points;
  4674.  
  4675.   ch_game_d();
  4676.  
  4677.   ny_remove("SENTBEST.TEN");
  4678.  
  4679.   if (findfirst("NYBEST.TEN",&fff,0)==0) {
  4680.     justfile=ShareFileOpen("NYBEST.TEN","r+b");
  4681.     len_of_list=filelength(fileno(justfile))/sizeof(best_rec_type) +1;
  4682.     if (len_of_list>10) len_of_list=10;
  4683.  
  4684.     while (cnt<10 && ny_fread(&best_rec,sizeof(best_rec_type),1,justfile)==1) {
  4685.       if (cur_user.points>=best_rec.points) {
  4686.     //fseek(justfile,(long)cnt*sizeof(best_rec_type),SEEK_SET);
  4687.     //ny_fwrite(&best_rec2,sizeof(best_rec_type),1,justfile);
  4688.     strcpy(best_rec.name,best_rec2.name);
  4689.     best_rec.points=best_rec2.points;
  4690.     //cnt++;
  4691.     while (cnt<len_of_list) {
  4692.       fseek(justfile,(long)cnt*sizeof(best_rec_type),SEEK_SET);
  4693.       ny_fread(&best_rec2,sizeof(best_rec_type),1,justfile);
  4694.       fseek(justfile,(long)cnt*sizeof(best_rec_type),SEEK_SET);
  4695.       ny_fwrite(&best_rec,sizeof(best_rec_type),1,justfile);
  4696.       strcpy(best_rec.name,best_rec2.name);
  4697.       best_rec.points=best_rec2.points;
  4698.       cnt++;
  4699.     }
  4700.     fclose(justfile);
  4701.  
  4702.     if(ibbs==FALSE) {
  4703.       ny_line(302,2,1);
  4704.       //od_printf("\n\r\n\r`bright red`Y`red`ou made the `bright`BEST`red` list.\n\r");
  4705.  
  4706. //        WaitForEnter();
  4707.       if(rip)
  4708.         od_get_answer("\n\r");
  4709.     }
  4710.     return;
  4711.       }
  4712.       cnt++;
  4713.     }
  4714.     fclose(justfile);
  4715.     if (cnt<10) {
  4716.       justfile=ShareFileOpen("NYBEST.TEN","a+b");
  4717.       ny_fwrite(&best_rec2,sizeof(best_rec_type),1,justfile);
  4718.       fclose(justfile);
  4719.  
  4720.       if(ibbs==FALSE) {
  4721.     ny_line(302,2,1);
  4722.     //od_printf("\n\r\n\r`bright red`Y`red`ou made the `bright`BEST`red` list.\n\r");
  4723.  
  4724.     if(rip)
  4725.       od_get_answer("\n\r");
  4726.       }
  4727.       return;
  4728.     } else {
  4729.  
  4730.       if(ibbs==FALSE) {
  4731.     ny_line(303,2,1);
  4732.     //od_printf("\n\r\n\r`bright red`Y`red`ou didn't make the `bright`BEST`red` list.\n\r`bright red`T`red`here were better.\n\r");
  4733.  
  4734.   //    WaitForEnter();
  4735.     if(rip)
  4736.       od_get_answer("\n\r");
  4737.       }
  4738.       return;
  4739.     }
  4740.   }
  4741.   justfile=ShareFileOpen("NYBEST.TEN","wb");
  4742.   ny_fwrite(&best_rec2,sizeof(best_rec_type),1,justfile);
  4743.   fclose(justfile);
  4744.  
  4745.   if(ibbs==FALSE) {
  4746.     ny_line(302,2,1);
  4747. //    od_printf("\n\r\n\r`bright red`Y`red`ou made the `bright`BEST`red` list.\n\r
  4748.     if(rip)
  4749.       od_get_answer("\n\r");
  4750.     ny_line(304,0,1);
  4751.     if(rip)
  4752.       od_get_answer("\n\r");
  4753.   }
  4754.   //`bright red`A`red`ctually ya were the first to do it.\n\r");
  4755.  
  4756.  // WaitForEnter();
  4757.   return;
  4758. }
  4759.  
  4760. void
  4761. AddBestPlayerIB(void)
  4762. {
  4763. //  ffblk ffblk;
  4764.   ibbs_best_rec_type best_rec,best_rec2;
  4765.   FILE *justfile;
  4766.   int cnt=0,len_of_list;
  4767.   strcpy(best_rec2.name,cur_user.name);
  4768.   strcpy(best_rec.location,IBBSInfo.szThisNodeAddress);
  4769.   best_rec2.points=cur_user.points;
  4770.  
  4771.  
  4772.   ch_game_d();
  4773.   if (findfirst("NYIBBEST.TEN",&fff,0)==0) {
  4774.     justfile=ShareFileOpen("NYIBBEST.TEN","r+b");
  4775.     len_of_list=filelength(fileno(justfile))/sizeof(ibbs_best_rec_type) +1;
  4776.     if (len_of_list>10) len_of_list=10;
  4777.  
  4778.     /*check if the same record exists*/
  4779.     while (cnt<10 && ny_fread(&best_rec,sizeof(ibbs_best_rec_type),1,justfile)==1) {
  4780.       if (cur_user.points==best_rec.points &&
  4781.       strcmp(best_rec.location,IBBSInfo.szThisNodeAddress)==0 &&
  4782.       strcmp(best_rec.name,cur_user.name)==0) {
  4783.     /*if it already exists quit this function*/
  4784.     fclose(justfile);
  4785.     return;
  4786.       }
  4787.     }
  4788.  
  4789.     /*rewind the file to beginning*/
  4790.     fseek(justfile,0,SEEK_SET);
  4791.  
  4792.     while (cnt<10 && ny_fread(&best_rec,sizeof(ibbs_best_rec_type),1,justfile)==1) {
  4793.       if (cur_user.points>=best_rec.points) {
  4794.     //fseek(justfile,(long)cnt*sizeof(best_rec_type),SEEK_SET);
  4795.     //ny_fwrite(&best_rec2,sizeof(best_rec_type),1,justfile);
  4796.     strcpy(best_rec.location,best_rec2.location);
  4797.     strcpy(best_rec.name,best_rec2.name);
  4798.     best_rec.points=best_rec2.points;
  4799.     //cnt++;
  4800.     while (cnt<len_of_list) {
  4801.       fseek(justfile,(long)cnt*sizeof(ibbs_best_rec_type),SEEK_SET);
  4802.       ny_fread(&best_rec2,sizeof(ibbs_best_rec_type),1,justfile);
  4803.       fseek(justfile,(long)cnt*sizeof(ibbs_best_rec_type),SEEK_SET);
  4804.       ny_fwrite(&best_rec,sizeof(ibbs_best_rec_type),1,justfile);
  4805.       strcpy(best_rec.location,best_rec2.location);
  4806.       strcpy(best_rec.name,best_rec2.name);
  4807.       best_rec.points=best_rec2.points;
  4808.       cnt++;
  4809.     }
  4810.     fclose(justfile);
  4811.  
  4812.     ny_line(302,2,1);
  4813.     //od_printf("\n\r\n\r`bright red`Y`red`ou made the `bright`BEST`red` list.\n\r");
  4814.  
  4815. //      WaitForEnter();
  4816.     if(rip)
  4817.       od_get_answer("\n\r");
  4818.     return;
  4819.       }
  4820.       cnt++;
  4821.     }
  4822.     fclose(justfile);
  4823.     if (cnt<10) {
  4824.       justfile=ShareFileOpen("NYIBBEST.TEN","a+b");
  4825.       ny_fwrite(&best_rec2,sizeof(ibbs_best_rec_type),1,justfile);
  4826.       fclose(justfile);
  4827.  
  4828.       ny_line(302,2,1);
  4829.       //od_printf("\n\r\n\r`bright red`Y`red`ou made the `bright`BEST`red` list.\n\r");
  4830.  
  4831.       if(rip)
  4832.     od_get_answer("\n\r");
  4833.       return;
  4834.     } else {
  4835.  
  4836.       ny_line(303,2,1);
  4837.       //od_printf("\n\r\n\r`bright red`Y`red`ou didn't make the `bright`BEST`red` list.\n\r`bright red`T`red`here were better.\n\r");
  4838.  
  4839.   //  WaitForEnter();
  4840.       if(rip)
  4841.     od_get_answer("\n\r");
  4842.       return;
  4843.     }
  4844.   }
  4845.   justfile=ShareFileOpen("NYIBBEST.TEN","wb");
  4846.   ny_fwrite(&best_rec2,sizeof(ibbs_best_rec_type),1,justfile);
  4847.   fclose(justfile);
  4848.  
  4849.   ny_line(302,2,1);
  4850. //  od_printf("\n\r\n\r`bright red`Y`red`ou made the `bright`BEST`red` list.\n\r
  4851.   if(rip)
  4852.     od_get_answer("\n\r");
  4853.   ny_line(304,0,1);
  4854.   if(rip)
  4855.     od_get_answer("\n\r");
  4856.   //`bright red`A`red`ctually ya were the first to do it.\n\r");
  4857.  
  4858.  // WaitForEnter();
  4859.   return;
  4860. }
  4861.  
  4862.  
  4863. void
  4864. AddBestPlayerInIB(char *name,unsigned long points)
  4865. {
  4866. //  ffblk ffblk;
  4867.   best_rec_type best_rec,best_rec2;
  4868.   FILE *justfile;
  4869.   int cnt=0,len_of_list;
  4870.   strcpy(best_rec2.name,name);
  4871.   best_rec2.points=points;
  4872.  
  4873.  
  4874.   ch_game_d();
  4875.   if (findfirst("NYIBBEST.TEN",&fff,0)==0) {
  4876.     justfile=ShareFileOpen("NYIBBEST.TEN","r+b");
  4877.     len_of_list=filelength(fileno(justfile))/sizeof(best_rec_type) +1;
  4878.     if (len_of_list>10) len_of_list=10;
  4879.  
  4880.  
  4881.  
  4882.     while (cnt<10 && ny_fread(&best_rec,sizeof(best_rec_type),1,justfile)==1) {
  4883.  
  4884.       if (points>=best_rec.points) {
  4885.     //fseek(justfile,(long)cnt*sizeof(best_rec_type),SEEK_SET);
  4886.     //ny_fwrite(&best_rec2,sizeof(best_rec_type),1,justfile);
  4887.     strcpy(best_rec.name,best_rec2.name);
  4888.     best_rec.points=best_rec2.points;
  4889.     //cnt++;
  4890.     while (cnt<len_of_list) {
  4891.       fseek(justfile,(long)cnt*sizeof(best_rec_type),SEEK_SET);
  4892.       ny_fread(&best_rec2,sizeof(best_rec_type),1,justfile);
  4893.       fseek(justfile,(long)cnt*sizeof(best_rec_type),SEEK_SET);
  4894.       ny_fwrite(&best_rec,sizeof(best_rec_type),1,justfile);
  4895.       strcpy(best_rec.name,best_rec2.name);
  4896.       best_rec.points=best_rec2.points;
  4897.       cnt++;
  4898.     }
  4899.     fclose(justfile);
  4900.  
  4901.     if(ibbs_maint_i==FALSE) {
  4902.       ny_line(302,2,1);
  4903.       //od_printf("\n\r\n\r`bright red`Y`red`ou made the `bright`BEST`red` list.\n\r");
  4904.  
  4905. //        WaitForEnter();
  4906.       if(rip)
  4907.         od_get_answer("\n\r");
  4908.     }
  4909.     return;
  4910.       }
  4911.       cnt++;
  4912.  
  4913.     }
  4914.  
  4915.     fclose(justfile);
  4916.     if (cnt<10) {
  4917.       justfile=ShareFileOpen("NYIBBEST.TEN","a+b");
  4918.       ny_fwrite(&best_rec2,sizeof(best_rec_type),1,justfile);
  4919.       fclose(justfile);
  4920.  
  4921.       if(ibbs_maint_i==FALSE) {
  4922.     ny_line(302,2,1);
  4923.     //od_printf("\n\r\n\r`bright red`Y`red`ou made the `bright`BEST`red` list.\n\r");
  4924.  
  4925.     if(rip)
  4926.       od_get_answer("\n\r");
  4927.       }
  4928.       return;
  4929.     } else {
  4930.  
  4931.       if(ibbs_maint_i==FALSE) {
  4932.     ny_line(303,2,1);
  4933.     //od_printf("\n\r\n\r`bright red`Y`red`ou didn't make the `bright`BEST`red` list.\n\r`bright red`T`red`here were better.\n\r");
  4934.  
  4935.   //    WaitForEnter();
  4936.     if(rip)
  4937.       od_get_answer("\n\r");
  4938.       }
  4939.       return;
  4940.     }
  4941.   }
  4942.   justfile=ShareFileOpen("NYIBBEST.TEN","wb");
  4943.   ny_fwrite(&best_rec2,sizeof(best_rec_type),1,justfile);
  4944.   fclose(justfile);
  4945.  
  4946.   if(ibbs_maint_i==FALSE) {
  4947.     ny_line(302,2,1);
  4948. //    od_printf("\n\r\n\r`bright red`Y`red`ou made the `bright`BEST`red` list.\n\r
  4949.     if(rip)
  4950.       od_get_answer("\n\r");
  4951.     ny_line(304,0,1);
  4952.     //Actually ya were the first to do it.
  4953.     if(rip)
  4954.       od_get_answer("\n\r");
  4955.    }
  4956.   return;
  4957. }
  4958.  
  4959.  
  4960. int
  4961. strzcmp(char str1[], char str2[])
  4962. {
  4963.   char temp1[40],
  4964.        temp2[40];
  4965.  
  4966.   strcpy(temp1,str1);
  4967.   strcpy(temp2,str2);
  4968.   strlwr(temp1);
  4969.   strlwr(temp2);
  4970.  
  4971. //  if (strstr(temp1,temp2)!=NULL) return 0; //found
  4972.   if (strstr(temp2,temp1)!=NULL) return 0;
  4973.  
  4974.   return 1;
  4975. }
  4976.  
  4977.  
  4978.  
  4979. void
  4980. mail_ops(void)
  4981. {
  4982.     char key;
  4983.     char hand[25];
  4984.     char omg[51];
  4985.     char numstr[26];
  4986.     char line[80],ovr[80];
  4987.     FILE *justfile;
  4988.     FILE *msg_file;
  4989.     scr_rec urec;
  4990.     user_rec u2rec;
  4991.     int unum,ret,cnt;
  4992.     mail_idx_type mail_idx;
  4993.     long fillen;
  4994.  
  4995.     ovr[0]=0;
  4996.     line[0]=0;
  4997.  
  4998.     do {
  4999.       key=callmenu("SAROCQ?\n\r",MAIL,344,FALSE);
  5000.       while (expert>0 && key=='?') {
  5001.         expert+=10;
  5002.         key=callmenu("SAROCQ?\n\r",MAIL,344,FALSE);
  5003.         expert-=10;
  5004.       }
  5005.  
  5006.  
  5007.       if (key=='Y') {
  5008.         DisplayStats();
  5009.         WaitForEnter();
  5010.       } else if (key=='C') {
  5011.  
  5012.         od_printf("\n\r\n\r");
  5013.         if(rip) {
  5014.           od_send_file("FRAME.RIP");
  5015.           od_send_file("FRAME1.RIP");
  5016.         }
  5017.         ny_send_menu(COLORS_HELP,"");
  5018. /*          od_printf("\n\r\n\r`bright red`S`red`o ya'd like to use colors, huh?\n\r\n\r");
  5019.         od_printf("`bright red`W`red`ell its easy. `bright red`T`red`hey can be used in mail and the stuff you say.\n\r\n\r");
  5020.         od_printf("`bright red`Y`red`ou simply type the `bright`");
  5021.         od_putch('`');
  5022.         od_printf("`red` character and one of the following:\n\r");
  5023.         ny_disp_emu("`11`22`33`44`55`66`77`88`99`00`!!`@@`##`$$`%%");
  5024.         od_printf("\n\r\n\r`bright`");
  5025.         od_putch('`');
  5026.         od_printf("$Colors ");
  5027.         od_putch('`');
  5028.         od_printf("0RULE\n\r\n\rWould look like:\n\r\n\r");
  5029.         ny_disp_emu("`$Colors `0RULE");
  5030.         ny_disp_emu("\n\r\n\r`@N`4OTE: `@S`4ame as in `@LORD\n\r");*/
  5031.  
  5032.         WaitForEnter();
  5033.  
  5034.       } else if (key=='S') {
  5035.  
  5036.         mail_idx.flirt=0;
  5037.  
  5038.         if(rip) od_send_file("TFRAME2.RIP");
  5039.         ny_line(305,2,0);
  5040.         //od_printf("\n\r\n\r`bright red`W`red`ho's mailbox do ya wanna fill (`bright red`full`red` or `bright red`partial`red` name):`bright green`");
  5041.  
  5042.         od_input_str(hand,24,' ',255);
  5043.         ny_un_emu(hand);
  5044.         //od_printf("\n\r");
  5045.         unum=0;
  5046.         ret=1;
  5047.         if (hand[0]!=0) {
  5048.           do {
  5049.         ch_game_d();
  5050.         justfile=ShareFileOpen(SCR_FILENAME,"rb");
  5051.         fseek(justfile,sizeof(scr_rec) * (long)unum,SEEK_SET);
  5052.         do {
  5053.           ret=ny_fread(&urec,sizeof(scr_rec),1,justfile);
  5054.           unum++;
  5055.         } while ((strzcmp(hand,ny_un_emu(urec.name,numstr)) || urec.user_num==nCurrentUserNumber) && ret==1);
  5056.         fclose(justfile);
  5057.           } while (ret==1 && askifuser(urec.name)==FALSE);
  5058.         }
  5059.         if (ret!=1) {
  5060.  
  5061.           ny_line(133,1,1);
  5062. //            od_printf("\n\r`bright red`G`red`ot no idea who you mean ...");
  5063.  
  5064.           if(!rip)
  5065.         WaitForEnter();
  5066.           else
  5067.         od_get_answer("\n\r");
  5068.         } else if (hand[0]!=0) {
  5069.           if (urec.sex!=cur_user.sex && cur_user.sex_today>0) {
  5070.  
  5071.         ny_line(306,1,0);
  5072. //              ny_disp_emu("\n\r`@A`4sk `@");
  5073.         if(!rip)
  5074.           ny_disp_emu(urec.name);
  5075.         else
  5076.           od_disp_str(ny_un_emu(urec.name,numstr));
  5077.         ny_line(307,0,0);
  5078. //              ny_disp_emu("`4 to have sex with you?(`@Y`4/`@N`4)");
  5079.  
  5080.         key=ny_get_answer("YN");
  5081.         if(!rip)
  5082.           od_printf("%c\n\r",key);
  5083.         else
  5084.           od_disp_str("\n\r");
  5085.         if (key=='Y') {
  5086.           if (cur_user.sex_today<=0) {
  5087.  
  5088.             ny_line(118,1,1);
  5089.             //od_printf("\n\r\n\r`bright`You already used up all your sex turns today ...\n\r");
  5090.  
  5091.             if(!rip)
  5092.               WaitForEnter();
  5093.             else
  5094.               od_get_answer("\n\r");
  5095.             od_printf("\n\r");
  5096.           } else {
  5097.             mail_idx.flirt=1;
  5098.             cur_user.sex_today--;
  5099.           }
  5100.         }
  5101.           }
  5102.           ch_game_d();
  5103.           justfile=ShareFileOpen(USER_FILENAME,"rb");
  5104.           fseek(justfile,sizeof(user_rec) * (long)urec.user_num,SEEK_SET);
  5105.           ny_fread(&u2rec,sizeof(user_rec),1,justfile);
  5106.           fclose(justfile);
  5107.  
  5108.           ny_line(308,1,1);
  5109.           //od_printf("\n\r`bright red`O`red`k type yer message now (`bright red`/s`red`=save `bright red`/a`red`=abort):\n\r");
  5110.  
  5111.           ch_flag_d();
  5112.           sprintf(numstr,"u%07d.tmg", nCurrentUserNumber);
  5113.           justfile=ShareFileOpen(numstr,"wb");
  5114.           cnt= -1;
  5115.           do {
  5116.         cnt++;
  5117.         get_line(ovr,line,ovr,TRUE);
  5118.         ny_fwrite(&line,80,1,justfile);
  5119.           } while ((line[0]!='/' && (line[1]!='s' || line[1]!='S')) && (line[0]!='/' && (line[1]!='a' || line[1]!='A')));
  5120.           fclose(justfile);
  5121.  
  5122.           if ((line[1]=='s' || line[1]=='S') && (cnt>0 || mail_idx.flirt==1)) {
  5123.         ny_line(135,0,1);
  5124.         //od_printf("\b\b`bright red`S`red`aving...\n\r");
  5125.         mail_idx.length=cnt;
  5126.         strcpy(mail_idx.sender,cur_user.name);
  5127.         strcpy(mail_idx.senderI,cur_user.bbsname);
  5128.         strcpy(mail_idx.recver,urec.name);
  5129.         strcpy(mail_idx.recverI,u2rec.bbsname);
  5130.         mail_idx.afterquote=0;
  5131.         mail_idx.deleted=FALSE;
  5132.         mail_idx.sender_sex=cur_user.sex;
  5133.         mail_idx.ill=cur_user.std;
  5134.         mail_idx.inf=cur_user.std_percent;
  5135.         ch_flag_d();
  5136.         justfile=ShareFileOpen(numstr,"rb");
  5137.         ch_game_d();
  5138.         msg_file=ShareFileOpen(MAIL_FILENAME,"a+b");
  5139.         fillen=filelength(fileno(msg_file));
  5140.         fillen/=80;
  5141.         mail_idx.location=fillen;
  5142.         while ((cnt--)>0) {
  5143.           ny_fread(&line,80,1,justfile);
  5144.           ny_fwrite(&line,80,1,msg_file);
  5145.         }
  5146.         fclose(msg_file);
  5147.         fclose(justfile);
  5148.         //sprintf(numstr,"del u%07d.tmg");
  5149.         //system(numstr);
  5150.         ch_flag_d();
  5151.         ny_remove(numstr);
  5152.         ch_game_d();
  5153.         msg_file=ShareFileOpen(MAIL_INDEX,"a+b");
  5154.         ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,msg_file);
  5155.         fclose(msg_file);
  5156.         if(single_node==FALSE && urec.online==TRUE) {
  5157.           ch_flag_d();
  5158.           sprintf(numstr,"u%07d.omg",urec.user_num);
  5159.           omg[0]=27;
  5160.           omg[1]=0;
  5161.           justfile=ShareFileOpen(numstr,"a+b");
  5162.           ny_fwrite(&omg,51,1,justfile);
  5163.           ny_fwrite(&cur_user.name,25,1,justfile);
  5164.           fclose(justfile);
  5165.         }
  5166.           } else {
  5167.         ny_line(136,0,1);
  5168. //              od_printf("\b\b`bright red`A`red`borted...\n\r");
  5169.           //sprintf(numstr,"del u%07d.tmg");
  5170.           //system(numstr);
  5171.         if(mail_idx.flirt==1) cur_user.sex_today++;
  5172.         ch_flag_d();
  5173.         ny_remove(numstr);
  5174.           }
  5175.           if(!rip)
  5176.         WaitForEnter();
  5177.           else
  5178.         od_get_answer("\n\r");
  5179.         }
  5180.       } else if (key=='R') {
  5181.         read_mail();
  5182.         if(ibbs)read_ibmail();
  5183.       } else if (key=='A') {
  5184.  
  5185.         if(rip) od_send_file("texti.rip");
  5186.         ny_line(309,2,1);
  5187.   //        od_printf("\n\r\n\r`bright red`S`red`ay what:\n\r");
  5188.         ny_line(310,0,1);
  5189.   //        od_printf("|-----------------------------------------------------------------------------|\n\r`bright green`");
  5190.  
  5191.         od_input_str(line,79,' ',255);
  5192.         if(line[0]!=0) {
  5193.           if(dobad)
  5194.         dobadwords(line);
  5195.           news_post(line,cur_user.name,"",1);
  5196.           ny_line(311,2,1);
  5197. //            od_printf("\n\r\n\r`bright red`P`red`osted...\n\r");
  5198.           if(!rip)
  5199.         WaitForEnter();
  5200.           else
  5201.         od_get_answer("\n\r");
  5202.         }
  5203.       } else if (key=='O') {
  5204.        if (single_node==TRUE) {
  5205.         //This is a Single Node only Game!!!!
  5206.         ny_line(338,2,1);
  5207.         if(!rip)
  5208.           WaitForEnter();
  5209.         else
  5210.           od_get_answer("\n\r");
  5211.        } else {
  5212.  
  5213.         if(rip) od_send_file("texti.rip");
  5214.         ny_line(312,2,0);
  5215.         //Who do ya want to bother (full or partial):
  5216.  
  5217.         od_input_str(hand,24,' ',255);
  5218.         ny_un_emu(hand);
  5219.         od_printf("\n\r");
  5220.         unum=0;
  5221.         if (hand[0]!=0) {
  5222.           do {
  5223.         ch_game_d();
  5224.         justfile=ShareFileOpen(SCR_FILENAME,"rb");
  5225.         fseek(justfile,sizeof(scr_rec) * (long)unum,SEEK_SET);
  5226. ask_online_again:;
  5227.         do {
  5228.           ret=ny_fread(&urec,sizeof(scr_rec),1,justfile);
  5229.           unum++;
  5230.         } while (strzcmp(hand,ny_un_emu(urec.name,numstr)) && ret==1);
  5231.         if (urec.online==FALSE && ret==1) goto ask_online_again;
  5232.         fclose(justfile);
  5233.           } while (ret==1 && askifuser(urec.name)==FALSE);
  5234.         }
  5235.         unum--;
  5236.         if (ret!=1) {
  5237.  
  5238.           ny_line(133,0,1);
  5239.           //Got no idea who you mean ...
  5240.  
  5241.           if(!rip)
  5242.         WaitForEnter();
  5243.           else
  5244.         od_get_answer("\n\r");
  5245.         } else if (hand[0]!=0) {
  5246.  
  5247.           ny_line(313,2,0);
  5248.           ny_line(314,1,1);
  5249.           //Ok type what u wanna say now:
  5250.           //+------------------------------------------------+
  5251.  
  5252.           od_input_str(omg,50,' ',255);
  5253.           if(dobad)
  5254.         dobadwords(omg);
  5255.  
  5256.           ch_flag_d();
  5257.           sprintf(numstr,"u%07d.omg",urec.user_num);
  5258.           justfile=ShareFileOpen(numstr,"a+b");
  5259.           ny_fwrite(&omg,51,1,justfile);
  5260.           ny_fwrite(&cur_user.name,25,1,justfile);
  5261.           fclose(justfile);
  5262.           ny_line(315,2,1);
  5263.           //Sent!
  5264.           if(!rip)
  5265.         WaitForEnter();
  5266.           else
  5267.         od_get_answer("\n\r");
  5268.         }
  5269.        }
  5270.       }
  5271.     } while (key!='Q');
  5272. }
  5273.  
  5274.  
  5275.  
  5276.  
  5277.  
  5278.  
  5279.  
  5280. void
  5281. read_mail(void)
  5282. {
  5283.   FILE *justfile;
  5284.   FILE *njustfile;
  5285.   long fillen;
  5286.   long filepos;
  5287.   mail_idx_type mail_idx;
  5288.   int intval;
  5289.   char numstr[36];
  5290.   char key;
  5291.   char ovr[80],line[80];
  5292.   int cnt,cnt2;
  5293.   int nonstop;
  5294.   user_rec urec;
  5295.   char omg[2];
  5296.   int unum;
  5297.   unsigned long mon, med;
  5298.  
  5299.   filepos=0;
  5300.  
  5301.   if(rip) od_send_file("TFRAME1.RIP");
  5302.  
  5303.   do {
  5304.     ch_game_d();
  5305.     justfile=ShareFileOpen(MAIL_INDEX,"rb");
  5306.     fseek(justfile,filepos,SEEK_SET);
  5307.     intval=ny_fread(&mail_idx,sizeof(mail_idx_type),1,justfile);
  5308.  
  5309.     ny_line(316,2,0);
  5310.     //Searching ...
  5311.     while (intval==1 && (strcmp(mail_idx.recverI,cur_user.bbsname)!=0 || mail_idx.deleted==TRUE))
  5312.       intval=ny_fread(&mail_idx,sizeof(mail_idx_type),1,justfile);
  5313.     filepos=ftell(justfile);
  5314.     fclose(justfile);
  5315.     if (intval==1) {
  5316.       nonstop=FALSE;
  5317.  
  5318.       ny_line(317,2,0);
  5319.       //Mail from:
  5320.       ny_disp_emu(mail_idx.sender);
  5321.       ny_line(318,0,0);
  5322.       //To:
  5323.       ny_disp_emu(mail_idx.recver);
  5324.       od_printf("\n\r");
  5325.       cnt=0;
  5326.       cnt2=2;
  5327.       if (mail_idx.flirt<=998) {
  5328.     ch_game_d();
  5329.     justfile=ShareFileOpen(MAIL_FILENAME,"rb");
  5330.     fseek(justfile,(long)mail_idx.location * 80,SEEK_SET);
  5331.     od_printf("`green`");
  5332.     while (cnt<mail_idx.length) {
  5333.       ny_fread(&line,80,1,justfile);
  5334.       if (cnt<mail_idx.afterquote) {
  5335.         ny_disp_emu("`9>`2");
  5336.         ny_disp_emu(line);
  5337.         od_printf("\n\r");
  5338.       } else {
  5339.         od_set_attrib(0x0a); //bright green
  5340.         ny_disp_emu(line);
  5341.         od_printf("\n\r");
  5342.       }
  5343.       cnt++;
  5344.       cnt2++;
  5345.       if (nonstop==FALSE && cnt2%od_control.user_screen_length==0) {
  5346.         fclose(justfile);
  5347.  
  5348.         ny_disp_emu("`%More (Y/n/=)");
  5349.         key=ny_get_answer("YN=\n\r");
  5350.         ny_disp_emu("\r            \r");
  5351.         cnt2=1;
  5352.         if(key=='N')
  5353.           return;
  5354.         else if(key=='=')
  5355.           nonstop=TRUE;
  5356.  
  5357.         ch_game_d();
  5358.         justfile=ShareFileOpen(MAIL_FILENAME,"rb");
  5359.         fseek(justfile,(long)(mail_idx.location+cnt) * 80,SEEK_SET);
  5360.       }
  5361.     }
  5362.     fclose(justfile);
  5363.  
  5364.     if (mail_idx.flirt==1) {
  5365.  
  5366.       ny_disp_emu("\n\r`@");
  5367.       ny_disp_emu(mail_idx.sender);
  5368.       ny_line(319,0,0);
  5369.       //wants to have sex with ya Ok?
  5370.       ny_line(320,1,0);
  5371.       //[O]=OK (sex) R=reply D=delete I=ignore >
  5372.  
  5373.       key=ny_get_answer("ORDI\n\r");
  5374.       if (key=='\n' || key=='\r') key='O';
  5375.     } else {
  5376.  
  5377.       ny_line(321,1,0);
  5378.       //R=reply [D]=delete I=ignore >
  5379.  
  5380.       key=ny_get_answer("RDI\n\r");
  5381.       if (key=='\n' || key=='\r') key='D';
  5382.     }
  5383.     od_printf("%c\n\r",key);
  5384.       } else if (mail_idx.flirt==999) {
  5385.  
  5386.     ny_disp_emu("\n\r`@");
  5387.     ny_disp_emu(mail_idx.sender);
  5388.     ny_line(322,0,1);
  5389.     //agreed and had sex with ya ...
  5390.  
  5391.     cur_user.since_got_laid=0;
  5392.     points_raise((long)50*(cur_user.level+1));
  5393.     illness(mail_idx.ill,mail_idx.inf);
  5394.     ch_game_d();
  5395.     justfile=ShareFileOpen(MAIL_INDEX,"r+b");
  5396.     fseek(justfile,filepos-sizeof(mail_idx_type),SEEK_SET);
  5397.     mail_idx.deleted=TRUE;
  5398.     ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,justfile);
  5399.     fclose(justfile);
  5400.     WaitForEnter();
  5401.     key=-1;
  5402.       } else if (mail_idx.flirt==1000) {
  5403.  
  5404.     ny_disp_emu("\n\r`@");
  5405.     ny_disp_emu(mail_idx.sender);
  5406.     ny_line(323,0,1);
  5407.     //raped you!!
  5408.  
  5409.     illness(mail_idx.ill,mail_idx.inf);
  5410.     ch_game_d();
  5411.     justfile=ShareFileOpen(MAIL_INDEX,"r+b");
  5412.     fseek(justfile,filepos-sizeof(mail_idx_type),SEEK_SET);
  5413.     mail_idx.deleted=TRUE;
  5414.     ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,justfile);
  5415.     fclose(justfile);
  5416.     WaitForEnter();
  5417.     key=-1;
  5418.       } else if (mail_idx.flirt==1001) {
  5419.  
  5420.     ny_disp_emu("\n\r`@");
  5421.     ny_disp_emu(mail_idx.sender);
  5422.     ny_line(324,0,1);
  5423.     //defeated you!!
  5424.  
  5425.     ch_game_d();
  5426.     justfile=ShareFileOpen(MAIL_INDEX,"r+b");
  5427.     fseek(justfile,filepos-sizeof(mail_idx_type),SEEK_SET);
  5428.     mail_idx.deleted=TRUE;
  5429.     ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,justfile);
  5430.     fclose(justfile);
  5431.     WaitForEnter();
  5432.     key=-1;
  5433.       } else if (mail_idx.flirt==1002) {
  5434.     ch_game_d();
  5435.     justfile=ShareFileOpen(MAIL_FILENAME,"rb");
  5436.     fseek(justfile,(long)mail_idx.location * 80,SEEK_SET);
  5437.     fread(&mon,sizeof(unsigned long),1,justfile);
  5438.     fclose(justfile);
  5439.  
  5440.  
  5441.     med=ULONG_MAX-mon;
  5442.     if (med<=cur_user.money)
  5443.       mon=med;
  5444.  
  5445.  
  5446.     ny_disp_emu("\n\r`@");
  5447.     ny_disp_emu(mail_idx.sender);
  5448.     ny_line(419,0,0);
  5449.     od_printf("%s",D_Num(mon));
  5450.     ny_line(420,0,1);
  5451.  
  5452.     cur_user.money+=mon;
  5453.  
  5454.     wrt_sts();
  5455.  
  5456.     justfile=ShareFileOpen(MAIL_INDEX,"r+b");
  5457.     fseek(justfile,filepos-sizeof(mail_idx_type),SEEK_SET);
  5458.     mail_idx.deleted=TRUE;
  5459.     ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,justfile);
  5460.     fclose(justfile);
  5461.     WaitForEnter();
  5462.     key=-1;
  5463.       }
  5464.  
  5465.       if (key=='D' || key=='R') {
  5466.     if (key=='D')
  5467.       ny_line(325,1,2);
  5468.       //Deleting...
  5469.     ch_game_d();
  5470.     justfile=ShareFileOpen(MAIL_INDEX,"r+b");
  5471.     fseek(justfile,filepos-sizeof(mail_idx_type),SEEK_SET);
  5472.     mail_idx.deleted=TRUE;
  5473.     ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,justfile);
  5474.     fclose(justfile);
  5475.     if(key=='D' && rip==TRUE)
  5476.       od_get_answer("\n\r");
  5477.       }
  5478.       if (key=='O') {
  5479.     /*sex with playeres goes here*/
  5480.     if (cur_user.sex_today<=0) {
  5481.  
  5482.       ny_line(118,1,1);
  5483.       //You already used up all your sex turns today ...
  5484.       ny_line(326,0,1);
  5485.       //Try again tomorrow....
  5486.  
  5487.       WaitForEnter();
  5488.     } else {
  5489.       ch_game_d();
  5490.       justfile=ShareFileOpen(MAIL_INDEX,"r+b");
  5491.       fseek(justfile,filepos-sizeof(mail_idx_type),SEEK_SET);
  5492.       mail_idx.deleted=TRUE;
  5493.       ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,justfile);
  5494.       fclose(justfile);
  5495.  
  5496.       ny_line(327,2,0);
  5497.       //You just had sex with
  5498.       ny_disp_emu(mail_idx.sender);
  5499.       ny_disp_emu("`4 ...\n\r");
  5500.  
  5501.       cur_user.since_got_laid=0;
  5502.       cur_user.sex_today--;
  5503.       points_raise((long)50*(cur_user.level+1));
  5504.  
  5505.       desease ill;
  5506.       int inf;
  5507.  
  5508.       inf=mail_idx.inf;
  5509.       ill=mail_idx.ill;
  5510.  
  5511.       strcpy(mail_idx.recver,mail_idx.sender);
  5512.       strcpy(mail_idx.sender,cur_user.name);
  5513.       strcpy(mail_idx.recverI,mail_idx.senderI);
  5514.       strcpy(mail_idx.senderI,cur_user.bbsname);
  5515.       mail_idx.flirt=999;
  5516.       mail_idx.deleted=FALSE;
  5517.       mail_idx.location=0;
  5518.       mail_idx.length=0;
  5519.       mail_idx.afterquote=0;
  5520.       mail_idx.ill=cur_user.std;
  5521.       mail_idx.inf=cur_user.std_percent;
  5522.       mail_idx.sender_sex=cur_user.sex;
  5523.       ch_game_d();
  5524.       justfile=ShareFileOpen(MAIL_INDEX,"a+b");
  5525.       ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,justfile);
  5526.       fclose(justfile);
  5527.       if(single_node==FALSE) {
  5528.  
  5529.         unum=0;
  5530.  
  5531.         ch_game_d();
  5532.         justfile=ShareFileOpen(USER_FILENAME,"rb");
  5533.         while(ny_fread(&urec,sizeof(user_rec),1,justfile)==1) {
  5534.           if(strcmp(urec.bbsname,mail_idx.recverI)==0) {
  5535.         fclose(justfile);
  5536.         ch_flag_d();
  5537.         sprintf(numstr,"u%07d.on",unum);
  5538.         if(findfirst(numstr,&fff,0)==0) {
  5539.           sprintf(numstr,"u%07d.omg",unum);
  5540.           omg[0]=27;
  5541.           omg[1]=1;
  5542.           justfile=ShareFileOpen(numstr,"a+b");
  5543.           ny_fwrite(&omg,51,1,justfile);
  5544.           ny_fwrite(&cur_user.name,25,1,justfile);
  5545.           fclose(justfile);
  5546.         }
  5547.         goto found_the_guy;
  5548.           }
  5549.           unum++;
  5550.         }
  5551.         fclose(justfile);
  5552.         found_the_guy:;
  5553.       }
  5554.       illness(ill,inf);
  5555.       WaitForEnter();
  5556.     }
  5557.       }
  5558.       if (key=='R') {
  5559.     mail_idx.flirt=0;
  5560.     if (mail_idx.sender_sex!=cur_user.sex && cur_user.sex_today>0) {
  5561.  
  5562.       ny_line(328,1,0);
  5563.       //Ask
  5564.       if(!rip)
  5565.         ny_disp_emu(mail_idx.sender);
  5566.       else
  5567.         od_disp_str(ny_un_emu(mail_idx.sender,numstr));
  5568.       ny_line(329,0,0);
  5569.       //to have sex with you?(Y/N)
  5570.  
  5571.       key=ny_get_answer("YN");
  5572.       if(!rip)
  5573.         od_printf("%c\n\r",key);
  5574.       else
  5575.         od_disp_str("\n\r");
  5576.       if (key=='Y') {
  5577.         if (cur_user.sex_today<=0) {
  5578.  
  5579.           ny_line(118,1,1);
  5580.           //You already used up all your sex turns today ...
  5581.  
  5582.           WaitForEnter();
  5583.           od_printf("\n\r");
  5584.         } else {
  5585.           mail_idx.flirt=1;
  5586.           cur_user.sex_today--;
  5587.         }
  5588.       }
  5589.     }
  5590.  
  5591.     ny_line(330,1,0);
  5592.     //Quote message? (Y/N)
  5593.  
  5594.     key=ny_get_answer("YN");
  5595.     if(!rip)
  5596.       od_printf("%c\n\r",key);
  5597.     else
  5598.       od_disp_str("\n\r");
  5599.     ch_flag_d();
  5600.     sprintf(numstr,"u%07d.tmg",nCurrentUserNumber);
  5601.     njustfile=ShareFileOpen(numstr,"wb");
  5602.  
  5603.     ny_line(308,1,1);
  5604.     //Ok type yer message now (/s=save /a=abort):
  5605.     if (key=='N') {
  5606.       mail_idx.afterquote=0;
  5607.     } else {
  5608.       ch_game_d();
  5609.       justfile=ShareFileOpen(MAIL_FILENAME,"rb");
  5610.       cnt= mail_idx.afterquote;
  5611.       fseek(justfile,(long)(mail_idx.location+cnt) * 80,SEEK_SET);
  5612.       while (cnt<mail_idx.length) {
  5613.         ny_fread(&line,80,1,justfile);
  5614.         ny_fwrite(&line,80,1,njustfile);
  5615.         ny_disp_emu("`9>`2");
  5616.         ny_disp_emu(line);
  5617.         ny_disp_emu("\n\r");
  5618.         cnt++;
  5619.       }
  5620.       fclose(justfile);
  5621.       mail_idx.afterquote=cnt-mail_idx.afterquote;
  5622.     }
  5623.  
  5624.     cnt=-1;
  5625.     ovr[0]=0;
  5626.     do {
  5627.       cnt++;
  5628.       get_line(ovr,line,ovr,TRUE);
  5629.       ny_fwrite(&line,80,1,njustfile);
  5630.     } while ((line[0]!='/' && line[1]!='S') && (line[0]!='/' && line[1]!='A'));
  5631.     fclose(njustfile);
  5632.     if (line[1]=='s' || line[1]=='S') {
  5633.       ny_line(135,0,1);
  5634. //        od_printf("\b\b`bright red`S`red`aving...\n\r");
  5635.       cnt+=mail_idx.afterquote;
  5636.       mail_idx.length=cnt;
  5637.       strcpy(mail_idx.recver,mail_idx.sender);
  5638.       strcpy(mail_idx.sender,cur_user.name);
  5639.       strcpy(mail_idx.recverI,mail_idx.senderI);
  5640.       strcpy(mail_idx.senderI,cur_user.bbsname);
  5641.       mail_idx.deleted=FALSE;
  5642.       mail_idx.sender_sex=cur_user.sex;
  5643.       mail_idx.ill=cur_user.std;
  5644.       mail_idx.inf=cur_user.std_percent;
  5645.       ch_flag_d();
  5646.       njustfile=ShareFileOpen(numstr,"rb");
  5647.       ch_game_d();
  5648.       justfile=ShareFileOpen(MAIL_FILENAME,"a+b");
  5649.       fillen=filelength(fileno(justfile));
  5650.       fillen/=80;
  5651.       mail_idx.location=fillen;
  5652.       while ((cnt--)>0) {
  5653.         ny_fread(&line,80,1,njustfile);
  5654.         ny_fwrite(&line,80,1,justfile);
  5655.       }
  5656.       fclose(justfile);
  5657.       fclose(njustfile);
  5658.       //sprintf(numstr,"del u%07d.tmg");
  5659.       //system(numstr);
  5660.       ch_flag_d();
  5661.       ny_remove(numstr);
  5662.       ch_game_d();
  5663.       justfile=ShareFileOpen(MAIL_INDEX,"a+b");
  5664.       ny_fwrite(&mail_idx,sizeof(mail_idx_type),1,justfile);
  5665.       fclose(justfile);
  5666.  
  5667.       if(single_node==FALSE) {
  5668. //          scr_rec srec;
  5669.  
  5670.         unum=0;
  5671.  
  5672.         ch_game_d();
  5673.         justfile=ShareFileOpen(USER_FILENAME,"rb");
  5674.         while(ny_fread(&urec,sizeof(user_rec),1,justfile)==1) {
  5675.           if(strcmp(urec.bbsname,mail_idx.recverI)==0) {
  5676.         fclose(justfile);
  5677.         ch_flag_d();
  5678.         sprintf(numstr,"u%07d.on",unum);
  5679.         if(findfirst(numstr,&fff,0)==0) {
  5680.           sprintf(numstr,"u%07d.omg",unum);
  5681.           omg[0]=27;
  5682.           omg[1]=1;
  5683.           justfile=ShareFileOpen(numstr,"a+b");
  5684.           ny_fwrite(&omg,51,1,justfile);
  5685.           ny_fwrite(&cur_user.name,25,1,justfile);
  5686.           fclose(justfile);
  5687.         }
  5688.         goto found_the_guy_2;
  5689.           }
  5690.           unum++;
  5691.         }
  5692.         fclose(justfile);
  5693.         found_the_guy_2:;
  5694.       }
  5695.     } else {
  5696.       ny_line(136,0,1);
  5697.       //od_printf("\b\b`bright red`A`red`borted...\n\r");
  5698.       //sprintf(numstr,"del u%07d.tmg");
  5699.       //system(numstr);
  5700.       ch_flag_d();
  5701.       ny_remove(numstr);
  5702.       if(mail_idx.flirt==1) cur_user.sex_today++;
  5703.     }
  5704.     if(!rip)
  5705.       WaitForEnter();
  5706.     else
  5707.       od_get_answer("\n\r");
  5708.       }
  5709.     }
  5710.   } while (intval==1);
  5711. //  printf("\n\r12\n\r");
  5712. }
  5713.  
  5714. char
  5715. *LocationOf(char *address) {
  5716.   int iCurrentSystem;
  5717.   if(IBBSInfo.paOtherSystem == NULL && IBBSInfo.nTotalSystems != 0)
  5718.     return NULL;
  5719.   for(iCurrentSystem = 0; iCurrentSystem < IBBSInfo.nTotalSystems;++iCurrentSystem) {
  5720.     if(strcmp(IBBSInfo.paOtherSystem[iCurrentSystem].szAddress,address)==0) {
  5721.       return IBBSInfo.paOtherSystem[iCurrentSystem].szSystemName;
  5722.     }
  5723.   }
  5724.   return NULL;
  5725. }
  5726.  
  5727. void
  5728. read_ibmail(void)
  5729. {
  5730.   FILE *justfile;
  5731. //  FILE *njustfile;
  5732. //  long fillen;
  5733.   long filepos;
  5734.   ibbs_mail_type ibmail;
  5735.   int intval;
  5736.   char numstr[36];
  5737.   char key;
  5738.   char ovr[80];//,line[80];
  5739.   int cnt;//,cnt2;
  5740.   //char turnround[4]={'-','\\','|','/'};
  5741. //  int nonstop;
  5742. //  user_rec urec;
  5743. //  char omg[2];
  5744. //  int unum;
  5745. //  ffblk ffblk;
  5746.   int num;
  5747.   unsigned long mon, med;
  5748.  
  5749.   filepos=0;
  5750.  
  5751. //  if(rip) od_send_file("TFRAME1.RIP");
  5752.  
  5753.   ch_game_d();
  5754.   if(findfirst("NYIBBS.MIN",&fff,0)!=0)
  5755.     return;
  5756.  
  5757.   do {
  5758.     ch_game_d();
  5759.     justfile=ShareFileOpen("NYIBBS.MIN","rb");
  5760.     fseek(justfile,filepos,SEEK_SET);
  5761.     intval=ny_fread(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  5762.     ny_line(316,2,0);
  5763.     while (intval==1 && (strcmp(ibmail.recverI,cur_user.bbsname)!=0 || ibmail.deleted==TRUE))
  5764.       intval=ny_fread(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  5765.     filepos=ftell(justfile);
  5766.     fclose(justfile);
  5767.     if (intval==1) {
  5768. //      nonstop=FALSE;
  5769.       ny_line(317,2,0);
  5770.       ny_disp_emu(ibmail.sender);
  5771.       od_printf(" `dark green`(%s)",LocationOf(ibmail.node_s));
  5772.       ny_line(318,0,0);
  5773.       //ny_disp_emu("  `@T`4o: `0");
  5774.       ny_disp_emu(ibmail.recver);
  5775.       od_printf("\n\r");
  5776.       cnt=0;
  5777. //      cnt2=2;
  5778.       if (ibmail.flirt<=998) {
  5779.     od_printf("`green`");
  5780.     while (cnt<ibmail.quote_length && cnt<10) {
  5781.       ny_disp_emu("`9>`2");
  5782.       ny_disp_emu(ibmail.lines[cnt]);
  5783.       od_printf("\n\r");
  5784.       cnt++;
  5785.     }
  5786.     cnt=0;
  5787.     while (cnt<ibmail.length && cnt<10) {
  5788.       //od_printf("`bright green`");
  5789.       od_set_attrib(0x0a);
  5790.       ny_disp_emu(ibmail.lines[cnt+ibmail.quote_length]);
  5791.       od_printf("\n\r");
  5792.       cnt++;
  5793.     }
  5794.     if (ibmail.flirt==1) {
  5795.  
  5796.       ny_disp_emu("\n\r`@");
  5797.       ny_disp_emu(ibmail.sender);
  5798.       //      od_printf("\n\r`bright red`%s`red`
  5799.       ny_line(319,0,0);
  5800. //        wants to have sex with ya Ok?",mail_idx.sender);
  5801.       ny_line(320,1,0);
  5802.       //od_printf("\n\r`bright blue`[O]`red`=OK (sex) `bright blue`R`red`=reply `bright blue`D`red`=delete `bright blue`I`red`=ignore `bright blue`>"); //S`red`=stop `bright blue` >");
  5803.  
  5804.       key=ny_get_answer("ORDI\n\r");
  5805.       if (key=='\n' || key=='\r') key='O';
  5806.     } else {
  5807.  
  5808.       ny_line(321,1,0);
  5809. //        od_printf("\n\r`bright blue`R`red`=reply `bright blue`[D]`red`=delete `bright blue`I`red`=ignore `bright blue`>"); //S`red`=stop `bright blue`>");
  5810.  
  5811.       key=ny_get_answer("RDI\n\r");
  5812.       if (key=='\n' || key=='\r') key='D';
  5813.     }
  5814.     od_printf("%c\n\r",key);
  5815.       } else if (ibmail.flirt==999) {
  5816.  
  5817.     ny_disp_emu("\n\r`@");
  5818.     ny_disp_emu(ibmail.sender);
  5819.     od_printf(" `dark green`(%s)",LocationOf(ibmail.node_s));
  5820.     ny_line(322,0,1);
  5821. //      ny_disp_emu("`4 agreed and had sex with ya ...\n\r");
  5822.  
  5823.     cur_user.since_got_laid=0;
  5824.     points_raise((long)50*(cur_user.level+1));
  5825.     illness(ibmail.ill,ibmail.inf);
  5826.     ch_game_d();
  5827.     justfile=ShareFileOpen("NYIBBS.MIN","r+b");
  5828.     fseek(justfile,filepos-sizeof(ibbs_mail_type),SEEK_SET);
  5829.     ibmail.deleted=TRUE;
  5830.     ny_fwrite(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  5831.     fclose(justfile);
  5832.     WaitForEnter();
  5833.       } else if (ibmail.flirt==1003) {
  5834.  
  5835.     if(random(2)==0) {
  5836.       if(random(2)==0) {
  5837.         ny_disp_emu("\n\r`@");
  5838.         ny_disp_emu(ibmail.sender);
  5839.         od_printf(" `dark green`(%s)",LocationOf(ibmail.node_s));
  5840.         ny_line(458,0,1);
  5841.       } else {
  5842.         ny_line(459,1,1);
  5843.       }
  5844.       illness(ibmail.ill,ibmail.inf);
  5845.     } else {
  5846.       ny_line(460,1,1);
  5847.     }
  5848.     ch_game_d();
  5849.     justfile=ShareFileOpen("NYIBBS.MIN","r+b");
  5850.     fseek(justfile,filepos-sizeof(ibbs_mail_type),SEEK_SET);
  5851.     ibmail.deleted=TRUE;
  5852.     ny_fwrite(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  5853.     fclose(justfile);
  5854.     WaitForEnter();
  5855.       } else if (ibmail.flirt==1005) {
  5856.  
  5857.     if(random(3)==0) {
  5858.       if(random(2)==0) {
  5859.         ny_disp_emu("\n\r`@");
  5860.         ny_disp_emu(ibmail.sender);
  5861.         od_printf(" `dark green`(%s)",LocationOf(ibmail.node_s));
  5862.         ny_line(463,0,1);
  5863.       } else {
  5864.         ny_line(464,1,1);
  5865.       }
  5866. //        illness(ibmail.ill,ibmail.inf);
  5867.       cur_user.hitpoints*=2.0/3.0;;
  5868.       ny_line(466,1,1);
  5869.     } else {
  5870.       ny_line(465,1,1);
  5871.     }
  5872.     ch_game_d();
  5873.     justfile=ShareFileOpen("NYIBBS.MIN","r+b");
  5874.     fseek(justfile,filepos-sizeof(ibbs_mail_type),SEEK_SET);
  5875.     ibmail.deleted=TRUE;
  5876.     ny_fwrite(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  5877.     fclose(justfile);
  5878.     WaitForEnter();
  5879.       } else if (ibmail.flirt==1004) {
  5880.     ny_disp_emu("\n\r`@");
  5881.     ny_disp_emu(ibmail.sender);
  5882.     od_printf(" `dark green`(%s)",LocationOf(ibmail.node_s));
  5883.     ny_line(461,0,2);
  5884.     ny_line(462,0,1);
  5885.  
  5886.     WaitForEnter();
  5887.  
  5888.     ch_game_d();
  5889.     justfile=ShareFileOpen("NYIBBS.MIN","r+b");
  5890.     fseek(justfile,filepos-sizeof(ibbs_mail_type),SEEK_SET);
  5891.     ibmail.deleted=TRUE;
  5892.     ny_fwrite(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  5893.     fclose(justfile);
  5894.     num=*(int *)ibmail.lines[0];
  5895.  
  5896.     any_attack_ops(&cur_user,"`@H`4ired `@H`4itman `@F`4ight",ibmail.lines[1],
  5897.     (long)random(pow(1.72,(double)cur_user.level+1)*10)+pow(1.7,(double)cur_user.level+1)*10,
  5898.     (long)random(pow(1.31,(double)cur_user.level+1)*4)+pow(1.3,(double)cur_user.level+1)*(18.0+num)/10.0,
  5899.     (long)random(pow(1.31,(double)cur_user.level+1)*4)+pow(1.3,(double)cur_user.level+1)*(18.0+num)/10.0,
  5900.     (weapon)cur_user.level);
  5901.  
  5902.       } else if (ibmail.flirt==1002) {
  5903.     mon=*((unsigned long *)ibmail.lines[0]);
  5904.  
  5905.     med=ULONG_MAX-mon;
  5906.     if (med<=cur_user.money)
  5907.       mon=med;
  5908.  
  5909.     ny_disp_emu("\n\r`@");
  5910.     ny_disp_emu(ibmail.sender);
  5911.     od_printf(" `dark green`(%s)",LocationOf(ibmail.node_s));
  5912.     ny_line(419,0,0);
  5913.     od_printf("%s",D_Num(mon));
  5914.     ny_line(420,0,1);
  5915.  
  5916.     cur_user.money+=mon;
  5917.  
  5918.     wrt_sts();
  5919.  
  5920.     justfile=ShareFileOpen("NYIBBS.MIN","r+b");
  5921.     fseek(justfile,filepos-sizeof(ibbs_mail_type),SEEK_SET);
  5922.     ibmail.deleted=TRUE;
  5923.     ny_fwrite(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  5924.     fclose(justfile);
  5925.     WaitForEnter();
  5926.       }
  5927.  
  5928. //    if (key=='S') break;
  5929.       if (key=='D' || key=='R') {
  5930.     if (key=='D')
  5931.       ny_line(325,1,2); //od_printf("\n\r`bright red`D`red`eleting...\n\r\n\r");
  5932.     ch_game_d();
  5933.     justfile=ShareFileOpen("NYIBBS.MIN","r+b");
  5934.     fseek(justfile,filepos-sizeof(ibbs_mail_type),SEEK_SET);
  5935.     ibmail.deleted=TRUE;
  5936. //      od_printf("}>}%d{<{",(int)ibmail.deleted);
  5937. //      filepos=0;
  5938.     ny_fwrite(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  5939.     fclose(justfile);
  5940.  
  5941.     if(key=='D' && rip==TRUE)
  5942.       od_get_answer("\n\r");
  5943.       }
  5944.       if (key=='O') {
  5945.     /*sex with playeres goes here*/
  5946.     if (cur_user.sex_today<=0) {
  5947.  
  5948.       ny_line(118,1,1);
  5949.       //od_printf("\n\r\n\r`bright`You already used up all your sex turns today ...\n\r");
  5950.       ny_line(326,0,1);
  5951.       //od_printf("\n\rTry again tomorrow....\n\r");
  5952.  
  5953.       WaitForEnter();
  5954.     } else {
  5955.       ch_game_d();
  5956.       justfile=ShareFileOpen("NYIBBS.MIN","r+b");
  5957.       fseek(justfile,filepos-sizeof(ibbs_mail_type),SEEK_SET);
  5958.       ibmail.deleted=TRUE;
  5959.       ny_fwrite(&ibmail,sizeof(ibbs_mail_type),1,justfile);
  5960.       fclose(justfile);
  5961.  
  5962.       ny_line(327,2,0);
  5963.       //od_printf("\n\r\n\r`bright red`Y`red`ou just had sex with `bright red`
  5964.       ny_disp_emu(ibmail.sender);
  5965.       od_printf(" `dark green`(%s)",LocationOf(ibmail.node_s));
  5966.       ny_disp_emu("`4 ...\n\r");
  5967.  
  5968.       cur_user.since_got_laid=0;
  5969.       cur_user.sex_today--;
  5970.       points_raise((long)50*(cur_user.level+1));
  5971.  
  5972.       desease ill;
  5973.       int inf;
  5974.  
  5975.       inf=ibmail.inf;
  5976.       ill=ibmail.ill;
  5977.  
  5978.       strcpy(ibmail.recver,ibmail.sender);
  5979.       strcpy(ibmail.sender,cur_user.name);
  5980.       strcpy(ibmail.node_r,ibmail.node_s);
  5981.       strcpy(ibmail.node_s,IBBSInfo.szThisNodeAddress);
  5982.       strcpy(ibmail.recverI,ibmail.senderI);
  5983.       strcpy(ibmail.senderI,cur_user.bbsname);
  5984.       ibmail.flirt=999;
  5985.       ibmail.deleted=FALSE;
  5986. //        ibmail.location=0;
  5987.       ibmail.length=0;
  5988.       ibmail.quote_length=0;
  5989.       ibmail.ill=cur_user.std;
  5990.       ibmail.inf=cur_user.std_percent;
  5991.       ibmail.sender_sex=cur_user.sex;
  5992.       sprintf(IBBSInfo.szProgName, "#@NYG#%05d MAIL",ibbs_game_num);
  5993.       IBSendMail(&IBBSInfo,&ibmail);
  5994.       //IBSend(&IBBSInfo,ibmail.node_r,&ibmail,sizeof(ibbs_mail_type)-(20*81));
  5995.       illness(ill,inf);
  5996.       WaitForEnter();
  5997.     }
  5998.       }
  5999.       if (key=='R') {
  6000.     ibmail.flirt=0;
  6001.     if (ibmail.sender_sex!=cur_user.sex && cur_user.sex_today>0) {
  6002.  
  6003.       ny_line(328,1,0);
  6004. //        od_printf("\n\r`bright red`A`red`sk `bright red`
  6005.       if(!rip)
  6006.         ny_disp_emu(ibmail.sender);
  6007.       else
  6008.         od_disp_str(ny_un_emu(ibmail.sender,numstr));
  6009.       ny_line(329,0,0);
  6010.       //`red` to have sex with you?(`bright red`Y`red`/`bright red`N`red`)",mail_idx.sender);
  6011.  
  6012.       key=ny_get_answer("YN");
  6013.       if(!rip)
  6014.         od_printf("%c\n\r",key);
  6015.       else
  6016.         od_disp_str("\n\r");
  6017.       if (key=='Y') {
  6018.         if (cur_user.sex_today<=0) {
  6019.  
  6020.           ny_line(118,1,1);
  6021.           //od_printf("\n\r\n\r`bright`You already used up all your sex turns today ...\n\r");
  6022.  
  6023.           WaitForEnter();
  6024.           od_printf("\n\r");
  6025.         } else {
  6026.           ibmail.flirt=1;
  6027.           cur_user.sex_today--;
  6028.         }
  6029.       }
  6030.     }
  6031.  
  6032.     ny_line(330,1,0);
  6033.     //od_printf("\n\r`bright red`Q`red`uote message? (`bright red`Y`red`/`bright red`N`red`)");
  6034.  
  6035.     key=ny_get_answer("YN");
  6036.     if(!rip)
  6037.       od_printf("%c\n\r",key);
  6038.     else
  6039.       od_disp_str("\n\r");
  6040.  
  6041.     if(key=='Y') {
  6042.       if(ibmail.quote_length>0) {
  6043.         for(cnt=0;cnt<ibmail.length;cnt++)
  6044.           strcpy(ibmail.lines[cnt],ibmail.lines[cnt+ibmail.quote_length]);
  6045.         ibmail.quote_length=ibmail.length;
  6046.       } else {
  6047.         ibmail.quote_length=ibmail.length;
  6048.       }
  6049.       while (cnt<ibmail.length) {
  6050.         ny_disp_emu("`9>`2");
  6051.         ny_disp_emu(ibmail.lines[cnt]);
  6052.         ny_disp_emu("\n\r");
  6053.         cnt++;
  6054.       }
  6055.     } else {
  6056.       ibmail.quote_length=0;
  6057.     }
  6058.     ny_line(446,1,1);
  6059.     //od_printf("\n\r`bright red`O`red`k type yer message now (`bright red`/s`red`=save `bright red`/a`red`=abort):\n\r");
  6060.     cnt=-1;
  6061.     ovr[0]=0;
  6062.     do {
  6063.       cnt++;
  6064.       if(cnt<9)
  6065.         get_line(ovr,ibmail.lines[cnt+ibmail.quote_length],ovr,TRUE);
  6066.       else
  6067.         get_line(ovr,ibmail.lines[cnt+ibmail.quote_length],ovr,FALSE);
  6068.     } while ((ibmail.lines[cnt+ibmail.quote_length][0]!='/' &&
  6069.           ibmail.lines[cnt+ibmail.quote_length][1]!='S') &&
  6070.          (ibmail.lines[cnt+ibmail.quote_length][0]!='/' &&
  6071.           ibmail.lines[cnt+ibmail.quote_length][1]!='A') &&
  6072.          cnt<9);
  6073.  
  6074.     if (ibmail.lines[cnt+ibmail.quote_length][1]=='s' || ibmail.lines[cnt+ibmail.quote_length][1]=='S' || cnt==9) {
  6075.       ny_line(135,0,1);
  6076. //        od_printf("\b\b`bright red`S`red`aving...\n\r");
  6077.       //cnt+=mail_idx.afterquote;
  6078.       ibmail.length=cnt;
  6079.       strcpy(ibmail.recver,ibmail.sender);
  6080.       strcpy(ibmail.sender,cur_user.name);
  6081.       strcpy(ibmail.node_r,ibmail.node_s);
  6082.       strcpy(ibmail.node_s,IBBSInfo.szThisNodeAddress);
  6083.       strcpy(ibmail.recverI,ibmail.senderI);
  6084.       strcpy(ibmail.senderI,cur_user.bbsname);
  6085.       ibmail.deleted=FALSE;
  6086.       ibmail.sender_sex=cur_user.sex;
  6087.       ibmail.ill=cur_user.std;
  6088.       ibmail.inf=cur_user.std_percent;
  6089.       sprintf(IBBSInfo.szProgName, "#@NYG#%05d MAIL",ibbs_game_num);
  6090.       IBSendMail(&IBBSInfo,&ibmail);
  6091.       //IBSend(&IBBSInfo,ibmail.node_r,&ibmail,sizeof(ibbs_mail_type)-((20-ibmail.length-ibmail.quote_length)*81));
  6092. //        od_printf(">>%s<<",ibmail.node_r);
  6093.     } else {
  6094.       ny_line(136,0,1);
  6095.       if(ibmail.flirt==1) cur_user.sex_today++;
  6096.     }
  6097.     if(!rip)
  6098.       WaitForEnter();
  6099.     else
  6100.       od_get_answer("\n\r");
  6101.       }
  6102.     }
  6103.   } while (intval==1);
  6104. }
  6105.  
  6106. void
  6107. dobadwords(char *s)
  6108. {
  6109.   if(!dobad || badwordscnt==0)
  6110.     return;
  6111.  
  6112.   char badchars[]="@!#$&?@%*";
  6113.   int c;
  6114.   int len=strlen(s);
  6115.   int tryagain=FALSE;
  6116.  
  6117.   char *sm=(char *)malloc(len+1);
  6118.   if(sm==0)
  6119.     return;
  6120.  
  6121.   char *p,*pm;
  6122.  
  6123.   do {
  6124.     strcpy(sm,s);
  6125.     strupr(sm);
  6126.     tryagain=FALSE;
  6127.  
  6128.     for(int i=0;i<badwordscnt;i++) {
  6129.       od_kernal();
  6130.       p=sm;
  6131.       while((p=strstr(p,badwords[i]))!=0) {
  6132.     od_kernal();
  6133.     if(p==sm || *(p-1)<'A' || *(p-1)>'Z') {
  6134.       c=0;
  6135.       pm=(p-sm+s);
  6136.       while(*pm!=0 && c<strlen(badwords[i])) {
  6137.         *pm=badchars[random(9)];
  6138.         pm++;
  6139.         c++;
  6140.       }
  6141.       tryagain=TRUE;
  6142.     }
  6143.     if(++p=='\0')
  6144.       break;
  6145.       }
  6146.     }
  6147.   } while(tryagain);
  6148.   free(sm);
  6149. }
  6150.